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

Re: [Feature request] Add -u option to git rm to delete untracked files

From
Jeff King <peff@peff.net>
Date
May 27, 2020, 07:34 UTC
Message-ID
<20200527073432.GD4006199@coredump.intra.peff.net>
In-Reply-To
<1098602171.79502.1590528083387@mail.ziggo.nl>
On Tue, May 26, 2020 at 11:21:23PM +0200, Erik Janssen wrote:
> Would it be feasible to add a -u option to git rm to specify that I
> also want a file deleted if it is not tracked by git?

It might be a little tricky, as I suspect the code is starting from the set of tracked files, and then applying the arguments of pathspecs (but I didn't look too carefully, so I might be wrong).

The "git clean" command is made for this (and starts by iterating over the filesystem), and does exactly what you want. But I guess you are hoping for a state where you can just run "git rm" without having to think about whether the file is tracked or not.

-Peff
Previous: Erik JanssenNext: Đoàn Trần Công Danh
Message 2 of 5 in “[Feature request] Add -u option to git rm to delete untracked files”
  1. Erik JanssenMay 26, 2020
  2. Jeff KingMay 27, 2020
  3. Đoàn Trần Công DanhMay 27, 2020
  4. Randall S. BeckerMay 27, 2020
  5. Erik JanssenMay 27, 2020

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.