Since you received an error due to attraction, the damage has already been done: someone has already made the .DS_Store file on git . This, of course, should never happen, but it did.
You really don't want such files to be versioned, because
git will modify them when checking for commit, or, even worse, it will actively merge changes from someone else into a local .DS_Store when merging a branch, possibly creating a broken .DS_Store file. I have no idea what your OS does with the contents of these files, but it does not expect you to modify them in any way.
You will receive an error message when you try to check the version containing the .DS_Store file when your OS has changed it.
Non-Apple users will not like .DS_Store files clogging up your repository.
I would advise you to try to track down the origin of the file, because this information is central to solving this problem. Command
git log --all -- .DS_Store
gives you a list of all the .DS_Store that touched the .DS_Store file. These are the commits you need to rewrite in order to remove .DS_Store from your story.
Rewriting commits can, of course, be done using the large git filter-branch gun, but so far only the last commits that have not yet been merged can prevent git rebase -i from executing.
And of course, when you're done, put the .DS_Store in your .gitignore and check it out. This should prevent people from (accidentally) adding .DS_Store files in the future.
source share