Back

Explore Courses Blog Tutorials Interview Questions
+4 votes
1 view
in DevOps and Agile by (19.4k points)
edited by

How can I remove those annoying Mac OS X .DS_Store files from a Git repository?

1 Answer

+5 votes
by (27.5k points)
edited by

Step 1: In order to remove existing files from the repository:

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

Step 2: Add this line '.DS_Store' to your .gitignore file, which can be found at the top level of your repository (or create if it isn't there already. Use the following command to do so:

echo .DS_Store >> .gitignore

Step 3: Then run the following command: 

git add .gitignore

git commit -m '.DS_Store banished!'

For more information regarding this git commands and version controlling please go through the below link.

Welcome to Intellipaat Community. Get your technical queries answered by top developers!

28.4k questions

29.7k answers

500 comments

94.1k users

Browse Categories

...