>>>>> 77976da35a11db4580b80ae27e8d65caf5208086:file.txt 但是,我知道(使用一些 git 配置选项)-6ren">
gpt4 book ai didi

git:如何获取 merge 冲突的 "ours, theirs, original"?

转载 作者:IT王子 更新时间:2023-10-29 01:12:54 27 4
gpt4 key购买 nike

Git merge 冲突通常是这样显示的:

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

但是,我知道(使用一些 git 配置选项)也可以显示原始代码,而不仅仅是更改。像这样的东西:

<<<<<<< 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:如何获取 merge 冲突的 "ours, theirs, original"?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/8832201/

27 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com