Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Cannot rebase onto multiple branches

Tags:

git

When I'm trying to pull and rebase single branch, git is failing with Cannot rebase onto multiple branches.

I've browsed existing questions and all of them suggest specifying the branch to avoid the error. In my case it's still failing:

$ git pull --rebase origin master
From github.com:xxx/yyy
 * branch            master     -> FETCH_HEAD
Cannot rebase onto multiple branches

Running the command for 2-3 times helps and the repository gets pulled.

My git config:

[color]
        ui = true
[core]
        pager = less -r
        autocrlf = input
        excludesfile = /Users/kir/.gitignore_global
        editor = /usr/bin/vim
[push]
        default = simple
[filter "lfs"]
        clean = git-lfs clean %f
        smudge = git-lfs smudge %f
        required = true

Git version: 2.7.2 (latest from Brew)

like image 363
Kir Avatar asked Aug 30 '26 05:08

Kir


1 Answers

Try to set the rebase at the end of the command instead as the first flag:

git pull origin branch --rebase

If this is still doesnt work split it into 2 commands (pull = fetch + merge).

# fetch all the remote data
git fetch --all --prune

# no execute a merge command
git merge origin/branch --rebase
like image 156
CodeWizard Avatar answered Sep 01 '26 22:09

CodeWizard



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!