运行命令:

#当前文件夹及子文件夹内的 .DS_Store
find . -name .DS_Store -print0 | xargs -0 git rm --ignore-unmatch

Git 里忽略 .DS_Store:

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

#
git add . 
git commit -m ".remove DS.Store"
git push origin master

参考:.gitignore all the .DS_Store files in every folder and subfolder - stackoverflow

Last modification:March 5th, 2021 at 03:59 pm