我刚刚遇到了一个问题,合并一个分支到主git。首先,我通过运行git ls-remote来获得分支名称。我们称这个分支为“branch-name”。然后我运行git merge branch-name命令,得到如下结果:
fatal: branch-name - not something we can merge
如何解决此错误?
我刚刚遇到了一个问题,合并一个分支到主git。首先,我通过运行git ls-remote来获得分支名称。我们称这个分支为“branch-name”。然后我运行git merge branch-name命令,得到如下结果:
fatal: branch-name - not something we can merge
如何解决此错误?
当前回答
我的目标是将Branch2代码合并到Branch1中。
我在合并时得到了下面的消息。
我的分支Branch1和Branch2。请在项目文件夹中使用这些分支。
最初我只有分支1与脉泽,在这种情况下,我得到了下面提到的消息。
现在我已经签入了Branch2。
现在Branch1, Brnach2和master都在我的项目文件夹中。
现在开始合并步骤:
这是什么 起来
最后我们合并了Brnach2和Branch1
其他回答
为了避免错别字你可以做
git fetch --all -v
然后复制您的分支机构的名称并执行
git checkout <branch-name>
git checkout master
git merge <branch-name>
当我做一个git合并BRANCH_NAME“some commit message”时,我得到了这个错误-我忘记为提交消息添加-m标志,所以它认为分支名称包括注释。
下面的方法每次都对我有效。
git checkout master
git pull
git checkout branch-name-to-be-merged
git pull
git checkout branch-name
git pull
git merge branch-name-to-be-merged
这可能是因为该分支不在您的本地。合并使用前
git fetch origin
虽然听起来很奇怪,但重启电脑有助于解决这个问题。我使用IntelliJ IDEA中的终端,并自动完成分支名称,所以我非常确信这不是分支名称上的拼写错误。