Reproducing Git merge conflict: DD

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 are the differences between “git commit” and “git push”?
  • How to wrap git commit comments?
  • Git: move changes between branches without working directory change
  • Shortest hash? MD5 / SHA . First chars, git
  • Git clone fails with out of memory error - “fatal: out of memory, malloc failed (tried to allocate 905574791 bytes) / fatal: index-pack failed”
  • Pull changes Github to Github
  • 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.

  • Show all branches that commit A is on and commit B is not on?
  • Is there a way to make Git mark a file as conflicted?
  • Create a fork of public git repo for github
  • Using Git, is it possible to split up merge conflict resolution for a single merge between multiple developers?
  • Setting Git/SmartGit SSH Client's home folder
  • Git connection time out trying to clone via proxy
  • One Solution collect form web for “Reproducing Git merge conflict: DD”

    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 Baby is a git and github fan, let's start git clone.