Some of you may know about git merging. I'm learning. I am contributing a bit of work to an open-source library, Scikit-Image. One of the things you do out of politeness, to keep the commit history clean, is to rebase your (possibly many) commits into just one, so that the project's history shows your addition as truly one addition. If, as in my case, your addition ends up taking a long time to get reviewed, you may end up in the situation where you need to pull in the upstream changes that have happened in the meantime.

Let's go through the process I used:

# Add upstream source to pull from:
git add remote upstream https://github.com/scikit-image/scikit-image.git
# Merge upstream's changes into current branch
git pull upstream master
# Check the git log
git log
commit 7bdcdeef0d4146d630d2937ba7b619cd23f233fd
Merge: b9c82d0 f822439
Author: Michael Sarahan <msarahan@gmail.com>
Date: Sat Dec 6 20:27:20 2014 -0800

 Merge branch 'master' of https://github.com/scikit-image/scikit-image into PhaseCorrelation

commit b9c82d03f2c6c9584c834b05ffd5c3714248de4e
Author: Michael Sarahan <msarahan@gmail.com>
Date: Mon Apr 28 08:03:15 2014 -0700

 Add subpixel-precision phase correlation function to feature module

This is bad: an extra commit for the merge to update. What's worse, I had already pushed my branch with this extra commit to github, so it showed up in the pull request. Let's try to get rid of it:

git rebase -i master

(this contains all of the commits I brought in with the merge, but not the merge commit itself!)

How do I get rid of it, then?

git reset --hard BRANCHNAME~1

(Replace BRANCHNAME with the branch that you're currently working on.)

Now, a better way to bring in the updates from master:

git pull --rebase upstream master