Make a git whoops? Clean it up!
git rm --cached `git ls-files -i -X .gitignore`
This piece of magic uses your
.gitignore to sort out what should be deleted from git history, but keeps files locally. Great if you’ve accidentally committed a file that you need locally, but don’t want to be tracked in git.
This assumes that you’ve already got a
.gitignore file in place.