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

Re: [PATCH,RFC] Implement 'git rm --if-missing'

From
Avery Pennarun <apenwarr@gmail.com>
Date
Jul 16, 2008, 18:17 UTC
Message-ID
<32541b130807161117h54e97825o9119655f73138341@mail.gmail.com>
In-Reply-To
<20080716180617.GO32184@machine.or.cz>
On 7/16/08, Petr Baudis <pasky@suse.cz> wrote:
Show 9 quoted lines
>  On Wed, Jul 16, 2008 at 07:00:50PM +0100, Ciaran McCreesh wrote:
>  > git rm --if-missing will only remove files if they've already been removed from
>  > disk.
>  >
>  > Signed-off-by: Ciaran McCreesh <ciaran.mccreesh@googlemail.com>
>
>   what is the usage scenario? The porcelain options space is a precious
>  resource, so please explain why do you need this and who is going to use
>  it (especially with such a long name).
I see the idea here: right now you can do:
         touch a b c
         git add .

And have it auto-add all the new files, so "git commit" will work. But there is no equivalent for rm, because for obvious reasons,

        rm b c
        git rm .

Doesn't do the same thing. And "git add ." doesn't auto-recognize deletions, which probably also makes sense.

"git commit -a", on the other hand, will automatically commit all deletions for you. But you don't always want to commit *all* your changes just because you want to commit all your deletions.

That said, --if-missing is a bit unwieldy. I don't have a better suggestion though.

Have fun,
Avery
Previous: Petr BaudisNext: Junio C Hamano
Message 3 of 6 in “Implement 'git rm --if-missing'”
  1. Implement 'git rm --if-missing'Ciaran McCreesh, Jul 16, 2008
  2. Petr BaudisJul 16, 2008
  3. Avery PennarunJul 16, 2008
  4. Junio C HamanoJul 16, 2008
  5. Peter BaumannJul 16, 2008
  6. David ChristensenJul 16, 2008

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.