Published on 27 March 2020 Tweet
If you are a mac user and using git, you may accidentally commit a file with .DS_Store. Your windows colleague would be confused what does this files do and why do you commit it.
First of all, what is .DS_Store file? DS stands for Desktop Services, which are used for mac to work out how to display folders when you open them. Example of those custom attributes includes the position of icons. These are created and maintained by the Finder application in mac which you normally won’t notice these hidden files.
These files are not useful for windows users and you don’t need to commit them to Github repository. To remove existing files from the repository, you can run the below command:
find . -name .DS_Store -print0 | xargs -0 git rm -f --ignore-unmatch
After that, you may commit deleted those files and push to the remote repository. In order to prevent it from being added again, edit the .gitignore file and add this line:
This would then resolve the concerns from your colleagues.