Skip to content

Instantly share code, notes, and snippets.

@afanasy
Created October 12, 2011 14:36
Show Gist options
  • Save afanasy/1281380 to your computer and use it in GitHub Desktop.
Save afanasy/1281380 to your computer and use it in GitHub Desktop.
Ignore .DS_Store and remove it from git history
#ignore
echo '.DS_Store*' >> .gitignore
#remove from history
find . -name '.DS_Store*' | while read f; do git filter-branch --index-filter "git rm --cached --ignore-unmatch $f"; rm -rf .git/refs/original; done;
#cleanup
git gc --prune=now
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment