如果你的項(xiàng)目中還沒有自動(dòng)生成的 .DS_Store 文件寞缝,那么直接將 .DS_Store 加入到 .gitignore 文件就可以了蓖捶。如果你的項(xiàng)目中已經(jīng)存在 .DS_Store 文件劲适,那就需要先從項(xiàng)目中將其刪除贱纠,再將它加入到 .gitignore实昨。如下:
將 找到所有的.DS_Store欣喧,從本地和git倉庫中刪除
find . -name .DS_Store -print0 | xargs -0 git rm -f --ignore-unmatch
將 .DS_Store 加入到 .gitignore
echo .DS_Store >> ./.gitignore
更新項(xiàng)目
git add --all
git commit -m 'xxxx your msgs'
如果你只需要?jiǎng)h除磁盤上的 .DS_Store,可以使用下面的命令來刪除當(dāng)前目錄及其子目錄下的所有.DS_Store 文件:
find . -name '*.DS_Store' -type f -delete
禁止.DS_store生成:
defaults write com.apple.desktopservices DSDontWriteNetworkStores -bool TRUE
恢復(fù).DS_store生成:
defaults delete com.apple.desktopservices DSDontWriteNetworkStores
————————————————
版權(quán)聲明:本文為CSDN博主「蜀山大老王」的原創(chuàng)文章莲组,遵循CC 4.0 BY-SA版權(quán)協(xié)議,轉(zhuǎn)載請(qǐng)附上原文出處鏈接及本聲明暖夭。
原文鏈接:https://blog.csdn.net/qq_26702635/article/details/116791393