简体   繁体   English

“git pull --rebase”导致“无法重组到多个分支”

[英]“git pull --rebase” leads to “Cannot rebase onto multiple branches”

So, my work environment has precisely one branch with a remote companion on Github. 所以,我的工作环境恰好有一个分支,在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. 我正在尝试执行git pull --rebase ,以防止git push创建合并提交消息,这些消息不会向处理此项目的其他人提供新信息,只是搞砸了工作。 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? 调用git branch告诉我我的本地机器上只有一个分支,所以发生了什么?

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 fetch所有更改,然后手动重新绑定:

git rebase origin/branch

In my case, I had to be both specific about which remote and move the --rebase flag to the end of the command. 在我的情况下,我必须具体说明哪个远程并将 --rebase标志移动到命令的末尾。

So: git pull origin master --rebase 所以: git pull origin master --rebase

Learned from this answer: Git: Cannot rebase onto multiple branches 从这个答案中得知: Git:不能重新分支到多个分支

The simplest solution I discovered was to use TortoiseGit's contextual menu item "Git Sync". 我发现最简单的解决方案是使用TortoiseGit的上下文菜单项“Git Sync”。 In it is a means to do fetch & rebase on your current working branch. 它是一种在当前工作分支上进行获取和重组的方法。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM