[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