我怎样才能看到一个“三路差异”对于Git合并冲突? [英] How can I see a "three way diff" for a Git merge conflict?
问题描述
假设我在Git分支 master
和I git merge featurebranch
。在 foo.html
中存在冲突。
当我打开 foo.html
,我看到,在冲突区域, master
有什么和 featurebranch
有。但我无法确定在与 featurebranch
冲突的 master
上进行了哪些更改 ;我只知道现在的主人 。
我希望看到每个人应用的差异。
或者,要得到相同的信息,我可以看到:
master
现在
featurebranch
我怎么能看到这个? / p>
From git-merge(1),
可以使用其他样式,方法是将除了
<<<<<<<<
,=======
和>>>>>>>
标记,它使用另一个|||||||
标记,紧随原始文本。你可以说,原文只是陈述了一个事实,你方只是放弃了这个陈述而放弃了,而另一方则试图采取更积极的态度。您可以通过查看原始图片来获得更好的分辨率。
可以使用
$ git config --global merge.conflictstyle diff3
Suppose I'm on Git branch master
and I git merge featurebranch
. There is a conflict in foo.html
.
When I open foo.html
, I see, in the area of the conflict, what master
has and what featurebranch
has. But I can't really tell what change was made on master
that conflicted with featurebranch
; I only know what master has now.
I'd like to see the diff that each one applied.
Or, to get the same information, I could see:
- The version
master
has now - The version
featurebranch
has now - The version their common ancestor had
How can I see this?
From git-merge(1),
An alternative style can be used by setting the "merge.conflictstyle" configuration variable to "diff3".
In addition to the
<<<<<<<
,=======
, and>>>>>>>
markers, it uses another|||||||
marker that is followed by the original text. You can tell that the original just stated a fact, and your side simply gave in to that statement and gave up, while the other side tried to have a more positive attitude. You can sometimes come up with a better resolution by viewing the original.
This can be enabled using
$ git config --global merge.conflictstyle diff3
这篇关于我怎样才能看到一个“三路差异”对于Git合并冲突?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!