Skip to content

Instantly share code, notes, and snippets.

@blueyed
Forked from atnan/git-clean-cached.sh
Created September 24, 2010 16:23
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save blueyed/595631 to your computer and use it in GitHub Desktop.
Save blueyed/595631 to your computer and use it in GitHub Desktop.
#!/bin/bash
cat .gitignore | egrep -v "^#|^$" | while read line; do
if [ -n "$line" ]; then
for ignored_file in $( git ls-files "$line" ); do
git rm --cached "$ignored_file"
done
fi
done
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment