If you are a scrub like me, you checked in your code to git before you added a .gitignore and now your git repo is full of things you don’t want.  This is especially important when you are working with a compiled language like C#.

Here’s how to delete all the files from your repo that would have been ignored by your .gitignore:

git ls-files -i --exclude-from=.gitignore | xargs git rm --cached 

Leave a Reply

Post Navigation