"git pull --rebase" leads to "Cannot rebase onto multiple branches"

bourgtai picture bourgtai · Apr 2, 2012 · Viewed 11.1k times · Source

So, my work environment has precisely one branch with a remote companion on Github. I'm trying to do git pull --rebase in order to prevent git push from creating merge commit messages that don't provide new information to others working on this project and just gum up the works. But when I try that, it gives me this:

From https://github.com/our_profile/our_repository
 * branch            HEAD        -> FETCH_HEAD
Cannot rebase onto multiple branches

And the pull aborts. Calling git branch informs me that I have only one branch on my local machine, so what's going on?

Answer

poke picture poke · Apr 2, 2012

Try specifying exactly what remote branch you want to pull:

git pull --rebase origin branch

Alternatively you can also git fetch all changes from the remote repository first, and then rebase manually:

git rebase origin/branch