On Thu, Aug 9, 2018 at 10:36 AM Junio C Hamano <gitster@xxxxxxxxx> wrote: > Elijah Newren <newren@xxxxxxxxx> writes: > > > File/directory conflicts are somewhat difficult to resolve; by way of > > contrast, renames are much easier to handle. For file/directory > > conflicts, we already have to record the file under a different name in > > the working copy due to the directory being in the way; if we also record > > the file under a different name in the index then it simplifies matters > > for the user, and ensures that 'git reset --hard' and 'git merge --abort' > > will clean up files created by the merge operation. > > Yeah, and then our file "path" renamed to "path~2" to make room for > directory "path" they introduced, can be relocated to its final > place in the merge resolution, e.g. "git mv path~2 path/ours" or > "git mv path path.theirs && git mv path~2 path". Yes. :-) > Of course, "git rm" and "git mv" must work sensibly, if we want this > change to be truly helpful--but if not, they need to be fixed ;-) That actually brings up an interesting question. Right now, if given a path that appears in the index but at a stage greater than 0, git mv will fail with "not under version control". Obviously, that error message is a lie in such a case, but what should it do? Print a more accurate error message ("Refusing to rename file until you remove conflicts and git add it"?) Or, what I'd prefer, rename the entry (or entries) and keep the higher stage number(s) -- is there an unseen danger with doing this? (Alternatively, if there is only one entry with stage greater than 0 and it has no other conflicts, one could envision git mv doing the rename and dropping to stage 0 at the same time, but that sounds a bit dangerous to me.)