DEV Community

Wilbur Suero
Wilbur Suero

Posted on

Correctly ignoring .DS_Store files

This is a simple trick, but I'm posting it here as reference.

When you do git status and find some .DS_Store files scattered through your app's folders there a simple line to add to your .gitignore to ignore them all for good:

**/.DS_store
Enter fullscreen mode Exit fullscreen mode

However, if the .DS_Store files are already there type:

find . -name .DS_Store -print0 | xargs -0 git rm -f --ignore-unmatch
Enter fullscreen mode Exit fullscreen mode

This will remove them from folders and subfolders. Then just commit and push to your repo.

git commit -m "remove .DS_Store files from everywhere"
git push
Enter fullscreen mode Exit fullscreen mode

And that's it.

Top comments (0)