This series extends the concept of "excluded files" in `git clean` to make it useful to protect "precious files" that might be present in a specific developer's working tree (see below). Specifically, this series adds a `config.exclude` knob to configure "always excluded" files (same as `-e` on the command line), and a `--remove-excluded` flag (intentionally without a short form) to "REALLY remove everything, dammit!" This might seem like euphemism treadmill, but there is a specific use-case for all of the exclusion methods and options: .gitignore: files that _the project_ does not want to track or touch (build artifacts) clean.exclude: files that _the user_ does not want to track or touch (IDE configuration) git clean -x: remove build artifacts, but keep precious files (when a pristine build is desired) git clean -x --remove-excluded: remove everything, including precious files (e.g. for redistribution) For instance, if I use Sublime Text or JetBrains IDEs to work on projects, I might want to add this to my ~/.gitconfig: [clean] exclude = /*.sublime-* exclude = /.idea Or, if I make use of the Bear compiler wrapper to generate the compilation database in those projects that do not use any of the modern build-systems to automate such generation, I might write: [clean] exclude = /compile_commands.json This way, even if I run `git clean -fxd` to test a clean build, I do not need to worry about accidentally removing the compilation database that would take a bunch of CPU-time to regenerate. Ivan Shapovalov (3): clean, dir: add and use new helper `add_patterns_from_string_list()` clean: rename `ignored` -> `remove_ignored` clean: add `config.exclude` and `--remove-excluded` Documentation/config/clean.txt | 11 +++++++++++ Documentation/git-clean.txt | 22 +++++++++++++++------- builtin/clean.c | 32 +++++++++++++++++++++----------- dir.c | 15 +++++++++++++++ dir.h | 4 ++++ 5 files changed, 66 insertions(+), 18 deletions(-) -- 2.48.1.5.g9188e14f140