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

Re: On removing files and "git-rm is pointless"

From
Sam Vilain <sam@vilain.net>
Date
Dec 2, 2006, 20:00 UTC
Message-ID
<4571DB40.6020800@vilain.net>
In-Reply-To
<Pine.LNX.4.64.0612020919400.3476@woody.osdl.org>
Linus Torvalds wrote:
> I'd like it more if it defaulted to actually removing the file, preferably 
> refusing to with an error message if the file didn't match the index. 

index, or HEAD version? Otherwise you can "update-index"; "rm" without seeing something wrong is happening.

Show 5 quoted lines
> Final note: arguably, the current "git rm" is a better mirror image of 
> "git add" than what I suggest above. "git add" doesn't actually create the 
> working file (you had to do that yourself), so you _could_ argue that "git 
> rm" as it stands now is closer to the "reverse" of git add. The same is 
> true of the recursive behaviour.

For this reason I think that the current behaviour is not so broken. Everywhere else, it is up to the user to make the changes to the working copy that they want to commit. I like git-rm because I can go:

  rm -rf whatever
  git-rm whatever
I can see why you'd want
  git-rm -u whatever
or
  rm -rf whatever
  git-commit -a

An extra flag to actually unlink the files is less likely to cause bugs with porcelain expecting git-rm to behave as it does currently. If it is to be changed in backwards incompatible ways, there should probably be a deprecation time.

"rm -u" could alter the default semantics, ie, require the extra -r option to recurse and require -f unless things are safe.

Previous: Linus TorvaldsNext: Nicolas Pitre
Message 3 of 13 in “On removing files and "git-rm is pointless"”
  1. Carl WorthDec 2, 2006
  2. Linus TorvaldsDec 2, 2006
  3. Sam VilainDec 2, 2006
  4. Nicolas PitreDec 3, 2006
  5. Junio C HamanoDec 4, 2006
  6. Jakub NarebskiDec 4, 2006
  7. Linus TorvaldsDec 4, 2006
  8. Jakub NarebskiDec 4, 2006
  9. Olivier GalibertDec 4, 2006
  10. Junio C HamanoDec 5, 2006
  11. Nicolas PitreDec 5, 2006
  12. Carl WorthDec 5, 2006
  13. Junio C HamanoDec 5, 2006

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.