clean untracked files
rm $(git ls-files --other --exclude-standard)
You can setup git alias for this in your .git/config file:
[alias]
clean-untracked = !sh -c 'rm $(git ls-files --other --exclude-standard)' -
then you can use it as a normal git command:
git clean-untracked
Written by Roman Nowicki
Related protips
1 Response
Why not git clean -df
?
To show what will be removed you can use git clean -ndf
.
Also clean-untracked
may leave empty directories but git clean
removes untracked directories entirely.
over 1 year ago
·
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#