34

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?

bourgtai
  • 367
  • 1
  • 4
  • 9
  • 7
    Yeah, and executing *'git pull --rebase'* for the second time works! That`s because during the first action git fetched the data, so that remote and local master branches started indicating the same commit. – Andrii Bogachenko Apr 05 '17 at 16:17

3 Answers3

31

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
poke
  • 369,085
  • 72
  • 557
  • 602
17

In my case, I had to be both specific about which remote and move the --rebase flag to the end of the command.

So: git pull origin master --rebase

Learned from this answer: Git: Cannot rebase onto multiple branches

Community
  • 1
  • 1
Adam
  • 2,027
  • 1
  • 16
  • 27
-13

The simplest solution I discovered was to use TortoiseGit's contextual menu item "Git Sync". In it is a means to do fetch & rebase on your current working branch.

bourgtai
  • 367
  • 1
  • 4
  • 9
  • I thought git pull did a fetch by default which is evident by all the fetch messaging that comes in. What does the above add? – Hazok Aug 07 '13 at 20:37