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

[feature] git clean ignored files in nested repositories support

From
Alon Bar-Lev <alon.barlev@gmail.com>
Date
Jul 26, 2025, 12:00 UTC
Message-ID
<CAOazyz08vf65ezNMuUyOCYYHBGmDSeCtzXn=WdZAWGO9ZjCkAQ@mail.gmail.com>
Hi,

I am sure this was discussed in the past, I could not find any explicit discussion.

The `git clean` is a handy command, it can clean directories, including ignore files and also handle nested git repositories if a second -f is given.

    git clean -dxff

However, as far as I understand, it is not possible to clean ignored files in nested repositories, the `x` is applied only to the local repository.

As workaround following command may be used:
    git clean -dxff && git submodule foreach git clean -dxff

However, I expect the double `f` to take into account the `x` and also clean ignored files from the nested repository.

I am unsure if this is a bug or intentional.

If this is intentional, maybe a patch to have a second -x would be acceptable? so that we could have something like:

   git clean -dxxff

Any other suggestions? It would be nice to be able to clean the entire tree with a simple git clean command consistently in all scenarios.

Regards, Alon

Next: Alon Bar-Lev
Message 1 of 2 in “[feature] git clean ignored files in nested repositories support”
  1. Alon Bar-LevJul 26, 2025
  2. Alon Bar-LevAug 1, 2025

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.