git/list[1] front-page[2] threads[3] people[4] search[5] about
 

"git rm" is not a valid merge resolution?

From
Piotr Krukowiecki <piotr.krukowiecki@gmail.com>
Date
Mar 21, 2011, 18:27 UTC
Message-ID
<4D879882.4070608@gmail.com>
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
Next: Matthieu Moy
Message 1 of 6 in “"git rm" is not a valid merge resolution?”
  1. Piotr KrukowieckiMar 21, 2011
  2. Matthieu MoyMar 21, 2011
  3. Piotr KrukowieckiMar 21, 2011
  4. Junio C HamanoMar 21, 2011
  5. Piotr KrukowieckiMar 21, 2011
  6. Junio C HamanoMar 21, 2011

Read the whole thread, see it on lore, or plain text.

$ cat FOOTERMessages come from the public archive at lore.kernel.org/git, fetched every hour. The front page is chosen and written each morning by an AI editor and can be wrong; the threads themselves are the record. About and API. For agents: an MCP server at https://gitlist.dev/mcp, and any thread, story or person page as Markdown by adding .md to its URL (or sending Accept: text/markdown). Details in /llms.txt.