Cleaning a git repository
Sometimes, your repo acquires a lot of unnecessary clutter (test files, autoconf-generated files); a way to automatically remove all these files is with with git clean
. To remove all files in the working directory that aren't under source control:
git clean -fxd
The -d
flag tells git clean
to work recursively; -x
tells it to remove files being ignored, and -f
is required if the git configuration variable clean.requireForce
is enabled. Instead of -f
, the -n
option performs a dry run, only listing the files that would be removed.
Written by Kyle Isom
Related protips
Have a fresh tip? Share with Coderwall community!
Post
Post a tip
Best
#Git
Authors
khasinski
591.1K
dmichaelavila
500.4K
Related Tags
#git
Sponsored by #native_company# — Learn More
#native_title#
#native_desc#