Skip to content

Instantly share code, notes, and snippets.

@randyjhunt
Created January 4, 2009 21:49
Show Gist options
  • Star 7 You must be signed in to star a gist
  • Fork 3 You must be signed in to fork a gist
  • Save randyjhunt/43184 to your computer and use it in GitHub Desktop.
Save randyjhunt/43184 to your computer and use it in GitHub Desktop.
Remove and ignore .DS_Store files in git repository
# Ignore .DS_Store files from a git repository
# Find and remove existing files from the repository:
find . -name .DS_Store -print0 | xargs -0 git-rm
# Add the line ".DS_Store" to the file .gitignore, which can be found at the top level of your repository (or created if it isn't there already)
git add .gitignore
git commit -m ".DS_Store banished!"
# http://stackoverflow.com/questions/107701/how-can-i-remove-dsstore-files-from-a-git-repository
@fogonthedowns
Copy link

$ git commit -m "filter-branch --index-filter 'git rm --cached --ignore-unmatch .DS_Store"
$ git push origin master --force

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment