Take the 2-minute tour ×

I've forked a project. I've also added handle 'upstream' that points to the original repository, and origin points to forked repository. After few days, i tried to fetch content from upstream and rebase it. After rebase, it shows branch diverging message. Commands i used are:

git fetch upstream master
git rebase upstream/master

In what case does this happen or am i doing something wrong here?

p.s. I was on local master branch while executing those commands. Since i did not make any changes/commits i think i could have used pull command.

share|improve this question

1 Answer 1

up vote 3 down vote accepted

If you're not making any changes and just trying to keep your fork up to date, the workflow would be (assuming you have master checked out):

git fetch upstream master
git merge --ff-only upstream/master
git push origin master

The middle command is what you are missing. If you don't care about having a local branch that's up to date, then you can just (does not require master being checked out):

git fetch upstream master
git push origin upstream/master:master

That will move sync your fork but will not involve the local branch.

Hope this helps.

share|improve this answer
Any idea in what case this diversion takes place? –  bikashp Jun 8 '11 at 14:14
You can't be up to date everywhere. This is why it's a distributed vcs. Diversion takes place at your last commits in common –  Adam Dymitruk Jun 8 '11 at 15:27

Your Answer


