Git未能合并

时间:2014-01-15 19:29:02

标签: git merge

我创建了一个名为tmp的分支,进行了一些提交,现在当我尝试合并时,它失败了。当我输入git branch -avvv时,我会看到以下内容

master                f439a52 [origin/master] updated footer formatting
* tmp                 acc5818 added analytics and logos
remotes/origin/master f439a52 updated footer formatting

然后我检查了master,试图合并tmp,但是我遇到了一堆错误,例如CONFLICT (content): Merge conflict in ....

我试图再次检查tmp,但后来它说Automatic merge failed; fix conflicts and then commit the result.我不知道冲突是什么,所以我不知道如何修复它们。我想保留我在tmp分支中添加的所有内容。

我键入git reset --hard并切换回tmp。然后我删除了master,创建了一个新的master分支并尝试合并tmp,但同样的事情又发生了。

1 个答案:

答案 0 :(得分:0)

当你做的时候 git merge它会实际修改有冲突的文件,并向您显示差异。您必须手动编辑有冲突的文件,然后提交这些更改。

实施例

<<<<<<<
Changes made on the branch that is being merged into. In most cases,
this is the branch that I have currently checked out (i.e. HEAD).
|||||||
The common ancestor version.
=======
Changes made on the branch that is being merged in. This is often a 
feature/topic branch.
>>>>>>>