September 2009
Beginner
942 pages
85h 34m
English
clean
git clean -n|-f [-d] [-x]
Removes files from the work tree that are not in the Git index. By default, it only removes files that are not listed in .gitignore and does not remove directories. (To undo work tree changes to files that are in the index, use git checkout.)
You must provide one of -n or -f.
| -n (print only, do not remove) |
| -f (force removal of files) |
| -d (also remove extra directories) |
| -x (also remove files skipped by .gitignore) |
| -X (only remove files skipped by .gitignore) |
| -q (quiet) |
To remove all extra files in the work tree so the only files remaining are ones that would be there after a fresh git clone:
$ git clean -f -d -x
Removing fooTo see what would happen if you ran the above command:
$ git clean -n -d -x
Would remove foo