DS_Store檔案介紹
DS_Store 是給Finder用來存儲這個檔案夾的顯示屬性的:比如檔案圖示的擺放位置。删除以後的副作用就是這些資訊的失去。(當然,這點副作用其實不是太大).
如何删除GIT中的.DS_Store
删除 .DS_Store
如果你的項目中還沒有自動生成的 .DS_Store 檔案,那麼直接将 .DS_Store 加入到 .gitignore 檔案就可以了。如果你的項目中已經存在 .DS_Store 檔案,那就需要先從項目中将其删除,再将它加入到 .gitignore。如下:
删除項目中的所有.DS_Store。這會跳過不在項目中的 .DS_Store
1.find . -name .DS_Store -print0 | xargs -0 git rm -f --ignore-unmatch
将 .DS_Store 加入到 .gitignore
2.echo .DS_Store >> ~/.gitignore
更新項目
3.git add --all
4.git commit -m '.DS_Store banished!'
如果你隻需要删除磁盤上的 .DS_Store,可以使用下面的指令來删除目前目錄及其子目錄下的所有.DS_Store 檔案:
find . -name '*.DS_Store' -type f -delete
禁用或啟用自動生成
禁止.DS_store生成:
defaults write com.apple.desktopservices DSDontWriteNetworkStores -bool TRUE
恢複.DS_store生成:恢複.DS_store生成:
defaults delete com.apple.desktopservices DSDontWriteNetworkStores
作者:iOSReverse
連結:https://www.jianshu.com/p/fdaa8be7f6c3
來源:簡書
簡書著作權歸作者所有,任何形式的轉載都請聯系作者獲得授權并注明出處。