为什么"git merge"添加以代字号结尾的文件? [英] Why does 'git merge' add files ending with tilde?
问题描述
我正在合并两个相当分散的git分支. 自动合并完成后,我最终得到了具有两个版本的多个文件:
I'm in the process of merging two git branches that are fairly diverged. After the automatic merge is complete, I ended up having multiple files having two versions:
file.cc~HEAD
file.cc~branchA
原始的file.cc
不见了.
由于两个文件是相同的,所以我有些困惑.为什么会发生?它代表哪种冲突?
While the original file.cc
was gone.
Since both files are identical, I'm slightly puzzled. Why does it happen? Which kind of conflict does it represent?
推荐答案
正如您所提到的,您正在尝试合并两个完全不同的git分支.因此,在这种情况下,自动合并失败.
As you mention that you are trying to merge two git branches that are fairly diverged. So in this situation, automatic merge fail.
理想情况下,当您的本地文件说为file.cc
且要合并的其他分支中的文件存在很大差异或缺少任何共同祖先时,就会发生这种情况.然后,我们必须将这两个文件都保留在工作目录中,但会发生冲突.因此,创建了file.cc~HEAD
和file.cc~branchA
文件,并删除了原始文件file.cc
.
Ideally, this situation occurs when your local file let say file.cc
and file in the other branch in which you are merging are fairly diverged or lack any common ancestor so they cannot be merged. And then, we must keep both files in the working directory but as a conflict. So file.cc~HEAD
and file.cc~branchA
files created and original file file.cc
deleted.
有关git merge
的更多信息,请阅读此文章.
For more information on git merge
read this article.
这篇关于为什么"git merge"添加以代字号结尾的文件?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!