Intellipaat Back

Explore Courses Blog Tutorials Interview Questions
+4 votes
2 views
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.

31k questions

32.8k answers

501 comments

693 users

Browse Categories

...