重现Git合并冲突:DD [英] Reproducing Git merge conflict: DD

查看:199
本文介绍了重现Git合并冲突:DD的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在编写一个测试脚本,并在通过git status --short显示时尝试重现git merge conflict DD。
$ b


  • DD(未合并,已删除)

  • ul>

    我一直与我尝试的所有东西都没有冲突。



    我需要执行哪些步骤来生成 DD冲突? DD冲突意味着什么?



    我看到这个: Git:如何创建不同的未合并状态?
    但是,在那里列出的步骤不会在后来的Git版本中产生任何冲突。

    解决方案

    找到 https://github.com/git/git/blob/master/t/t7060-wtstatus.sh 。它很难阅读,但它包含所有git冲突类型的测试代码。



    生成DD:

      git init 
    echo test> main.txt
    git checkout -b冲突&& git add main.txt&& git commit -m main.txt&&
    git branch conflict_second&& git mv main.txt sub_master.txt
    git commit -mmain.txt在sub_master.txt中重命名&& git checkout conflict_second
    git mv main.txt sub_second.txt
    git commit -mmain.txt在sub_second.txt中重命名
    git reset --hard conflict_second
    git合并冲突

    结果:

      =  - > git status 
    在分支上conflict_second
    您有未合并的路径。
    (修复冲突并运行git commit)

    未合并路径:
    (根据需要使用git add / rm< file> ...来标记分辨率)

    都被删除:main.txt
    由他们添加:sub_master.txt
    由我们添加:sub_second.txt

    或者

      =  - > git status -s 
    DD main.txt
    UA sub_master.txt
    AU sub_second.txt


    I'm working on a test script and trying to reproduce git merge conflict DD when shown via "git status --short". I've seen this conflict type in the past.

    • DD (unmerged, both deleted)

    I keep coming up with no conflict with everything I try.

    What steps do I need to perform to generate "DD" conflict? What does a "DD" conflict mean?

    I saw this: Git: how to create different unmerged states? But the steps listed there no longer produce any conflicts in later versions of Git.

    解决方案

    Found a link to https://github.com/git/git/blob/master/t/t7060-wtstatus.sh. It's kind of hard to read, but it contains test code for all git conflict types.

    To produce 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
    

    Results in:

    =->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
    

    Or

    =->git status -s
    DD main.txt
    UA sub_master.txt
    AU sub_second.txt
    

    这篇关于重现Git合并冲突:DD的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆