我正在研究测试脚本并尝试通过“git status --short”显示重现git merge conflict DD。我过去见过这种冲突类型。
我不断与我尝试的所有事情发生冲突。
生成“DD”冲突需要执行哪些步骤? “DD”冲突是什么意思?
我看到了这个:Git: how to create different unmerged states? 但是在那里列出的步骤不再在以后的Git版本中产生任何冲突。
答案 0 :(得分:1)
找到https://github.com/git/git/blob/master/t/t7060-wtstatus.sh的链接。它有点难以阅读,但它包含所有git冲突类型的测试代码。
生成DD:
git init
echo test > main.txt
git checkout -b conflict && git add main.txt && git commit -m main.txt &&
git branch conflict_second && git mv main.txt sub_master.txt
git commit -m "main.txt renamed in sub_master.txt" && git checkout conflict_second
git mv main.txt sub_second.txt
git commit -m "main.txt renamed in sub_second.txt"
git reset --hard conflict_second
git merge conflict
结果:
=->git status
On branch conflict_second
You have unmerged paths.
(fix conflicts and run "git commit")
Unmerged paths:
(use "git add/rm <file>..." as appropriate to mark resolution)
both deleted: main.txt
added by them: sub_master.txt
added by us: sub_second.txt
或者
=->git status -s
DD main.txt
UA sub_master.txt
AU sub_second.txt