在 git 合并冲突中,生成的 BACKUP、BASE、LOCAL 和 REMOTE 文件是什么?
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/20381677/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me):
StackOverFlow
In a git merge conflict, what are the BACKUP, BASE, LOCAL, and REMOTE files that are generated?
提问by filler003
I assume the LOCAL and REMOTE files are just what their name suggests, but what are BASE and BACKUP for?
我认为 LOCAL 和 REMOTE 文件正如它们的名字所暗示的那样,但是 BASE 和 BACKUP 是做什么用的?
回答by Edward Thomson
Git performs a three-way merge, finding the common ancestor (aka "merge base") of the two branches you are merging. When you invoke git mergetool
on a conflict, it will produce these files suitable for feeding into a typical 3-way merge tool. Thus:
Git 执行三向合并,找到要合并的两个分支的共同祖先(又名“合并基础”)。当您调用git mergetool
冲突时,它将生成适合输入典型 3 路合并工具的这些文件。因此:
foo.LOCAL
: the "ours" side of the conflict - ie, your branch (HEAD
) that will contain the results of the mergefoo.REMOTE
: the "theirs" side of the conflict - the branch you are merging intoHEAD
foo.BASE
: the common ancestor. useful for feeding into a three-way merge toolfoo.BACKUP
: the contents of file before invoking the merge tool, will be kept on the filesystem ifmergetool.keepBackup = true
.
foo.LOCAL
:冲突的“我们的”方面 - 即您的分支 (HEAD
) 将包含合并的结果foo.REMOTE
:冲突的“他们的”方面 - 您正在合并的分支HEAD
foo.BASE
: 共同祖先。用于输入三路合并工具foo.BACKUP
: 调用合并工具之前文件的内容,如果mergetool.keepBackup = true
.