These are chat archives for OfficeDev/ews-java-api

3rd
Dec 2014
Avrom
@avromf
Dec 03 2014 19:57
@evpaassen Ok, how do I remove unwanted commits?
Erik van Paassen
@evpaassen
Dec 03 2014 19:58
Hi
which Git client do you use? command line?
Avrom
@avromf
Dec 03 2014 19:58
I have git for Windows but I can also open a command line as well.
Erik van Paassen
@evpaassen
Dec 03 2014 19:59
OK, I'm familiar with the CLI, so I'd prefer that one.
Avrom
@avromf
Dec 03 2014 20:00
Give me a sec...
Erik van Paassen
@evpaassen
Dec 03 2014 20:00
sure
Avrom
@avromf
Dec 03 2014 20:02
ok, I'm ready
Erik van Paassen
@evpaassen
Dec 03 2014 20:02
Ok, please checkout your Issue12 branch...
so: git checkout Issue12
Avrom
@avromf
Dec 03 2014 20:02
ok
Erik van Paassen
@evpaassen
Dec 03 2014 20:03
could you please check that there are no uncommitted changes, using 'git status'?
Avrom
@avromf
Dec 03 2014 20:03
I should note that these unwanted commits are on all of my branches, including main
this branch is up-to-date
Erik van Paassen
@evpaassen
Dec 03 2014 20:03
OK
Avrom
@avromf
Dec 03 2014 20:05
there is nothing to commit in this branch
Erik van Paassen
@evpaassen
Dec 03 2014 20:05
if you type 'git remote -vv', which repositories do you see? only 'origin'?
Avrom
@avromf
Dec 03 2014 20:07
no, I see more than that...
Erik van Paassen
@evpaassen
Dec 03 2014 20:07
OK, that's great
so origin is your own repository and upstream is the alias for the official upstream repo
Avrom
@avromf
Dec 03 2014 20:09
ok
Erik van Paassen
@evpaassen
Dec 03 2014 20:09
Please do 'git fetch upstream', so it fetches the latest info from the upstream repo
Avrom
@avromf
Dec 03 2014 20:09
done
Erik van Paassen
@evpaassen
Dec 03 2014 20:11
Then, while you have the Issue12 branch checked out, you can to 'git reset --hard upstream/master', to reset the HEAD pointer of the branch to the same state as the master branch of the upstream repo. This will delete all local changes on disk, but don't worry.
Avrom
@avromf
Dec 03 2014 20:13
Done.
Now get the following: HEAD is now at 1e1dc01 Merge pull request #110 from jimdunkerton/string-equality
Erik van Paassen
@evpaassen
Dec 03 2014 20:13
That's good.
The commit ID's of the commits with the relevant changes are: d2ac110 and ... let me have a look.
Yeah, only that one.
you can cherry-pick your commit with 'git cherry-pick d2ac110'
git then applies that commit on top of your current branch
You might get three minor merge conflicts though... But we can solve these.
Avrom
@avromf
Dec 03 2014 20:15
I now get:
[Issue12 882426c] Fix for #12
1 file changed, 19 insertions(+), 20 deletions(-)
Erik van Paassen
@evpaassen
Dec 03 2014 20:16
OK, that's even better.
You can now push your branch. Unfortunately, as we rewrote the history of the branch, we need to apply force with -f. So: 'git push -f origin Issue12'
Avrom
@avromf
Dec 03 2014 20:18
Done.
Erik van Paassen
@evpaassen
Dec 03 2014 20:19
Great! You can see it worked in the PR: OfficeDev/ews-java-api#138
Perhaps you should also reset your own master branch to the upstream/master branch if it only contains changes you don't want.
Avrom
@avromf
Dec 03 2014 20:22
Ok, I see it. Much cleaner.
I'll try doing this to my master branch. That was the main source of the issue in the first place. (I initially applied 3 separate bug fixes to the master and then created a pull request on it.)
Erik van Paassen
@evpaassen
Dec 03 2014 20:25
OK, to reset your master branch you can use:
git checkout master
git reset --hard upstream/master
But beware you lose all uncommited changed and all changes which are only in your master branch.
You can do the same trick with the Issue17 branch, I think. That would be:
git checkout Issue17
git reset --hard upstream/master
git cherry-pick 4b31fd2
git push -f origin Issue17
Avrom
@avromf
Dec 03 2014 20:26
I've now done that to my master branch but it still reports it being 15 commits ahead.
Erik van Paassen
@evpaassen
Dec 03 2014 20:27
Ok, that's because the upstream master is ahead of master in your own repo at Github
Let me take a look...
Avrom
@avromf
Dec 03 2014 20:28
It says "This branch is 15 commits ahead of OfficeDev:master "
Erik van Paassen
@evpaassen
Dec 03 2014 20:29
Ok, that's shouldn't be right.
If you use git status, it should tell you the ID of the last commit.
Could you tell me which ID that is?
Avrom
@avromf
Dec 03 2014 20:30
Issue17 is now corrected
Hold on
Erik van Paassen
@evpaassen
Dec 03 2014 20:31
I see that, great!
Avrom
@avromf
Dec 03 2014 20:31

On master I have....
On branch master
Your branch is behind 'origin/master' by 15 commits, and can be fast-forwarded.
(use "git pull" to update your local branch)

nothing to commit, working directory clean

Erik van Paassen
@evpaassen
Dec 03 2014 20:32
OK
'git push -f' should do the trick and overwrite your master branch at your own remote github repo
Then it will be back to the commit where the OfficeDev (upstream) repo is now...
Avrom
@avromf
Dec 03 2014 20:34
ok, it appears to be cleaned up
Erik van Paassen
@evpaassen
Dec 03 2014 20:34
Great.
Avrom
@avromf
Dec 03 2014 20:34
Thanks a lot. :)
Erik van Paassen
@evpaassen
Dec 03 2014 20:35
You're welcome. Thanks for your effort in fixing the libraries.
Avrom
@avromf
Dec 03 2014 20:36
You're welcome.