"git rm" is not a valid merge resolution?
From: Piotr Krukowiecki <hidden>
Date: 2016-06-15 22:50:50
Hi,
git-status shows a hint that says
use "git add/rm <file>..." as appropriate to mark resolution
But if I "git rm file" the file gets deleted. Is this really the
appropriate merge resolution?
I would expect "git rm" to maybe reset all the merge changes but
it seems to just delete the file.
I doubt that when you get merge conflicts you would like to delete
the file. That might be the case when in one of merge parents
the file was deleted, but not if both files existed.
When deleting the file it shows a message "needs merge", perhaps
the intention was to not delete the file in such case?
So maybe:
- don't list "rm" as appropriate to mark resolution, or
- list it only if the files was deleted on one parent
Example:
$ git init
$ echo a > a
$ git add a
$ git commit -a -m a
$ echo b > a
$ git commit -a -m b
$ git checkout -b topic HEAD^
$ echo c > a
$ git commit -a -m c
$ git merge master
Auto-merging a
CONFLICT (content): Merge conflict in a
Automatic merge failed; fix conflicts and then commit the result.
$ git status
# On branch topic
# Unmerged paths:
# (use "git add/rm <file>..." as appropriate to mark resolution)
#
# both modified: a
#
no changes added to commit (use "git add" and/or "git commit -a")
$ git rm a
a: needs merge
rm 'a'
$ git status
# On branch topic
# Changes to be committed:
#
# deleted: a
#
--
Piotr Krukowiecki