me@grafxflow

Written by me@grafxflow

20 Sep, 2022

0

1,980

Remove .DS_Store files from the repository

It's very annoying under macOS when creating a new repo we occasionally see the dreaded .DS_Store files appear. So here is how to remove those annoying Mac OS X .DS_Store files from a Git repository.

First remove the existing .DS_Store files from the repository:

find . -name .DS_Store -print0 | xargs -0 git rm -f --ignore-unmatch

Then add this line:

.DS_Store

to the file .gitignore, which can be found at the top level of your repository (or create the file if it isn't there already). You can do this easily with this command in the top directory:

echo .DS_Store >> .gitignore
Then commit the file to the repo:
git add .gitignore

All done.

Add comment

Smart Search

133 Following
50 Followers

me@grafxflow

Hull, United Kingdom

I am a Full-stack Developer who also started delving into the world of UX/UI Design a few years back. I blog and tweet to hopefully share a little bit of knowledge that can help others around the web. Thanks for stopping by!

Follow