English 中文(简体)
git:如何为合并冲突获得“资源、资源、原始”?
原标题:git: How to get "ours, theirs, original" for merge conflicts?
  • 时间:2012-01-12 08:46:08
  •  标签:
  • git
  • diff3

冲突如通常所示:

<<<<<<< HEAD:file.txt
Code changed by A
=======
Code changed by B
>>>>>>> 77976da35a11db4580b80ae27e8d65caf5208086:file.txt

然而,我知道(有一些<代码>git config选项)也可以显示原始代码,而不仅仅是改动。 类似:

<<<<<<< HEAD:file.txt
Code changed by A
=======
Original code
=======
Code changed by B
>>>>>>> 77976da35a11db4580b80ae27e8d65caf5208086:file.txt

然而,我再找不到选择。 谁能帮助我?

最佳回答

我从来没有想到解决办法:

git config --global merge.conflictstyle diff3

它实际上认为:

<<<<<<< HEAD:file.txt
Code changed by A
||||||| merged common ancestors
Original code
=======
Code changed by B
>>>>>>> 77976da35a11db4580b80ae27e8d65caf5208086:file.txt
问题回答
git checkout --conflict=diff3 -- file.txt

从事单一职业。





相关问题
git confusion - cloning a repo is returning a past version

Im having some confusion with my git usage. I cloned a repo from one comp to the other, and the new clone is the state of the original that was active some time ago. So its cloning a past version. ...

Appropriate strategy for tagging and hotfixing with git

I was wondering if the strategy I m using for tagging and hotfixing tags (which then I use for deploying rails applications) with git is appropriate. For tagging I just tag a commit of the master ...

Tips on upgrading CVS to git/hg?

We still use CVS, I use git and hg for my personal use though I m still a novice at both, but I realize they re much more modern and better, faster, distributed, etc. It s just everyone is so ...

Using Git in a TFS shop

Using Git at home has spoiled me - I now find using TFS at work to be a bit of a drag and want to explore the possibility of using Git locally and syncing somehow with TFS. I figure there are a few ...

热门标签