Git:无法基于多个分支

Kir*_*Kir 1 git

当我尝试拉取单个分支并对其重新设置基础时,git失败Cannot rebase onto multiple branches

我浏览了现有的问题,所有这些问题都建议指定分支以避免错误。就我而言,它仍然失败:

$ git pull --rebase origin master
From github.com:xxx/yyy
 * branch            master     -> FETCH_HEAD
Cannot rebase onto multiple branches
Run Code Online (Sandbox Code Playgroud)

运行该命令2-3次会有所帮助,并且存储库将被拉出。

我的git配置:

[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
Run Code Online (Sandbox Code Playgroud)

Git版本:2.7.2(Brew的最新版本)

Cod*_*ard 5

尝试在命令末尾设置变基,而不是将其设置为第一个标志:

git pull origin branch --rebase
Run Code Online (Sandbox Code Playgroud)

如果仍然不起作用,请将其拆分为2个命令(pull = fetch + merge)。

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

# no execute a merge command
git merge origin/branch --rebase
Run Code Online (Sandbox Code Playgroud)

  • 将 --rebase 移到最后实际上是有效的。问题是为什么? (4认同)