Removing files from git
Removing untracked files can be hard, so there is one-liner for that:
git ls-files --exclude-standard --other | xargs rm -f
Above line removes only untracked files. For removing ignored files run that:
git ls-files --ignored --exclude-standard --other | xargs rm -f
To remove both untracked and ignored files run this:
git ls-files --other | xargs rm -f
Written by Mateusz Lenik
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#