其实很简单的,参考这个帖子How can I Remove .DS_Store files from a Git repository?,这里记录下。
find . -name .DS_Store -print0 | xargs -0 git rm -f --ignore-unmatch
echo .DS_Store >> .gitignore git add .gitignore git commit -m '.DS_Store banished!'