"git pull --rebase" leads to "Cannot rebase onto multiple branches"
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
Admin
Updated on June 13, 2022Comments
-
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 preventgit 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 about 12 yearsThis 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 almost 11 yearsI 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 about 8 yearsDo you know why this situation occurred?
-
caot about 4 yearsIs there a way to find what branches have the issue?