对于 merge ,我用它来“保留我的”
git merge -X ours foo
这是为了“保留他们的”
git merge -X theirs foo
然而,在我最近的 merge 中,最好保留双方。 Git 是否为此制定了“策略”来避免手动编辑文件?
最佳答案
没有解决这些冲突的“merge 策略”。
但是,如果您真的想要这样的冲突:
<<<< ours
Foo
=========
Bar
>>>> theirs
解决
Foo
Bar
然后您可以配置“merge 驱动程序”。来自gitattributes手册页:
union
Run 3-way file level merge for text files, but take lines from both versions, instead of leaving conflict markers. This tends to leave the added lines in the resulting file in random order and the user should verify the result. Do not use this if you do not understand the implications.
向 .gitattributes 添加一行以使用它:
*.whatever merge=union
关于git merge ,保留两者,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/13263902/