Getting rid of .DS_Store from life
The whole hairy .DS_Store thing is annoying: it lurks in your repository all the time and appear on your changed files list all the time. Here’s how to banish .DS_Store from your programming life. In terminal, execute:
echo ".DS_Store" >> ~/.gitignore_global
echo "._.DS_Store" >> ~/.gitignore_global
echo "**/.DS_Store" >> ~/.gitignore_global
echo "**/._.DS_Store" >> ~/.gitignore_global
git config --global core.excludesfile ~/.gitignore_global
Verify the global ignore file is included by cat ~/.gitconfig
Reference: