Last Updated: February 25, 2016
·
575
· shekibobo

Clean your git repo without losing ignored files

I found this one online, and it's been a real lifesaver when I decide I didn't want to run rake assets:precompile on my dev machine:

# in .gitconfig
[alias]
    cleanse = "!git ls-files --others --exclude-standard | xargs rm"

Now you can remove all those new untracked files without losing critical-but-untracked files like database.yml or other local configs.