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

How to recursively clean only those untracked files that are not ignored?

From
IBIlya Basin <basinilya@gmail.com>
Date
Apr 19, 2014, 09:05 UTC
Message-ID
<925417488.20140419130552@gmail.com>
According to the help, without -x option git clean should let alone the ignored files, but it doesn't.
    [il@reallin test]$ cat .gitignore
    *.sar
    [il@reallin test]$ mkdir -p conf/sar && touch conf/sar/aaa.sar
    [il@reallin test]$ git status
    # On branch master
    nothing to commit, working directory clean
    [il@reallin test]$ git clean -df
    Removing conf/
conf/sar/aaa.sar is removed.
I already asked this http://stackoverflow.com/questions/23148736/git-clean-removes-ignored-files-by-default

Someone even replied that "git does exactly what documentation says". Well, maybe, but I have doubts that the combination '-df' (without '-x') is useful at all. If someone wanted to delete ignored files, he would use '-x' or '-X'.

Message 1 of 1 in “How to recursively clean only those untracked files that are not ignored?”
  1. Ilya BasinApr 19, 2014

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.