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

13,551

Solution 1

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

Solution 2

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

Share:
13,551
Admin
Author by

Admin

Updated on June 13, 2022

Comments

  • Admin
    Admin almost 2 years

    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?

  • Admin
    Admin about 12 years
    This nearly worked, but it ended up causing problems involving lots of files being marked for deletion. I had to go in to git GUI to save the work I had done on them.
  • Hazok
    Hazok almost 11 years
    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?
  • dbn
    dbn about 8 years
    Do you know why this situation occurred?
  • caot
    caot about 4 years
    Is there a way to find what branches have the issue?