- Delete files that are not tracked by git:git clean- Interactively delete files that are not tracked by git:git clean -i- Show what files would be deleted without actually deleting them:git clean --dry-run- Forcefully delete files that are not tracked by git:git clean -f- Delete untracked files, including ignored files in `.gitignore` and `.git/info/exclude`:git clean -x
git clean [-d] [-f] [-i] [-n] [-q] [-e <pattern>] [-x | -X] [--] <path>...
Cleans the working tree by recursively removing files that are not under version control, starting from the current directory.
Normally, only files unknown to Git are removed, but if the -x option is specified, ignored files are also removed. This can, for example, be useful to remove all build products.
If any optional <path>... arguments are given, only those paths are affected.
-e <pattern>, --exclude=<pattern>
When the command enters the interactive mode, it shows the files and directories to be cleaned, and goes into its interactive command loop.
The command loop shows the list of subcommands available, and gives a prompt "What now> ". In general, when the prompt ends with a single >, you can pick only one of the choices given and type return, like this:
*** Commands *** 1: clean 2: filter by pattern 3: select by numbers 4: ask each 5: quit 6: help What now> 1
You also could say c or clean above as long as the choice is unique.
The main command loop has 6 subcommands.
filter by pattern
select by numbers
Part of the git(1) suite