Git conflict "both deleted"
As stated in this answer (suggested as a duplicate) :
you can see a "both deleted" when branchA
has a git mv oldfile newstandard
commit, and branchB
has a git mv oldfile newcustom
commit.
In that case, when trying to merge customBranch
into standardBranch
, git
will report a conflict on three files :
both deleted: oldfileadded by them: newcustomadded by us: newstandard
Like any conflict, the final choice resides in your hands :
git
merely highlight the fact that maybe there could be a problem in the fact that newcustom
and newstandard
live together in your final code version, and maybe this could be linked to the fact that both were created by being a copy of oldfile
.
You get to manually fix that :
- if removing
oldfile
is the expected outcome :git reset -- oldfile
, - if keeping
newstandard
is the expected outcome, remove the other :git reset newcustom && git rm newcustom
, - if some parts of
newstandard
andnewcustom
should be merged : edit them by hand, or use a 3-way merge tool :meld newstandard newstandard newcustom
- etc ...