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

3rd
Dec 2014
Avrom
@avromf
Dec 03 2014 19:57 UTC
@evpaassen Ok, how do I remove unwanted commits?
Erik van Paassen
@evpaassen
Dec 03 2014 19:58 UTC
Hi
which Git client do you use? command line?
Avrom
@avromf
Dec 03 2014 19:58 UTC
I have git for Windows but I can also open a command line as well.
Erik van Paassen
@evpaassen
Dec 03 2014 19:59 UTC
OK, I'm familiar with the CLI, so I'd prefer that one.
Avrom
@avromf
Dec 03 2014 20:00 UTC
Give me a sec...
Erik van Paassen
@evpaassen
Dec 03 2014 20:00 UTC
sure
Avrom
@avromf
Dec 03 2014 20:02 UTC
ok, I'm ready
Erik van Paassen
@evpaassen
Dec 03 2014 20:02 UTC
Ok, please checkout your Issue12 branch...
so: git checkout Issue12
Avrom
@avromf
Dec 03 2014 20:02 UTC
ok
Erik van Paassen
@evpaassen
Dec 03 2014 20:03 UTC
could you please check that there are no uncommitted changes, using 'git status'?
Avrom
@avromf
Dec 03 2014 20:03 UTC
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 UTC
OK
Avrom
@avromf
Dec 03 2014 20:05 UTC
there is nothing to commit in this branch
Erik van Paassen
@evpaassen
Dec 03 2014 20:05 UTC
if you type 'git remote -vv', which repositories do you see? only 'origin'?
Avrom
@avromf
Dec 03 2014 20:07 UTC
no, I see more than that...
Erik van Paassen
@evpaassen
Dec 03 2014 20:07 UTC
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 UTC
ok
Erik van Paassen
@evpaassen
Dec 03 2014 20:09 UTC
Please do 'git fetch upstream', so it fetches the latest info from the upstream repo
Avrom
@avromf
Dec 03 2014 20:09 UTC
done
Erik van Paassen
@evpaassen
Dec 03 2014 20:11 UTC
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 UTC
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 UTC
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 UTC
I now get:
[Issue12 882426c] Fix for #12
1 file changed, 19 insertions(+), 20 deletions(-)
Erik van Paassen
@evpaassen
Dec 03 2014 20:16 UTC
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 UTC
Done.
Erik van Paassen
@evpaassen
Dec 03 2014 20:19 UTC
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 UTC
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 UTC
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 UTC
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 UTC
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 UTC
It says "This branch is 15 commits ahead of OfficeDev:master "
Erik van Paassen
@evpaassen
Dec 03 2014 20:29 UTC
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 UTC
Issue17 is now corrected
Hold on
Erik van Paassen
@evpaassen
Dec 03 2014 20:31 UTC
I see that, great!
Avrom
@avromf
Dec 03 2014 20:31 UTC

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 UTC
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 UTC
ok, it appears to be cleaned up
Erik van Paassen
@evpaassen
Dec 03 2014 20:34 UTC
Great.
Avrom
@avromf
Dec 03 2014 20:34 UTC
Thanks a lot. :)
Erik van Paassen
@evpaassen
Dec 03 2014 20:35 UTC
You're welcome. Thanks for your effort in fixing the libraries.
Avrom
@avromf
Dec 03 2014 20:36 UTC
You're welcome.