禁用或啟用自動生成禁止.DS_store生成:
defaults write com.apple.desktopservices DSDontWriteNetworkStores -bool TRUE
恢復.DS_store生成:恢復.DS_store生成:
defaults delete com.apple.desktopservices DSDontWriteNetworkStores
.DS_Store(英文全稱 Desktop Services Store)是一種由蘋果公司的Mac OS X操作系統所創造的隱藏文件,目的在于存貯目錄的自定義屬性,例如文件們的圖標位置或者是背景色的選擇。相當于 Windows 下的 desktop.ini。
刪除 .DS_Store
如果你的項目中還沒有自動生成的 .DS_Store 文件,那么直接將 .DS_Store 加入到 .gitignore 文件就可以了。
如果你的項目中已經存在 .DS_Store 文件,那就需要先從項目中將其刪除,再將它加入到 .gitignore。
刪除 .DS_Store
如果你的項目中還沒有自動生成的 .DS_Store 文件,那么直接將 .DS_Store 加入到 .gitignore 文件就可以了。如果你的項目中已經存在 .DS_Store 文件,那就需要先從項目中將其刪除,再將它加入到 .gitignore。如下:
刪除項目中的所有.DS_Store。這會跳過不在項目中的 .DS_Store
$ find . -name .DS_Store -print0 | xargs -0 git rm -f --ignore-unmatch
rm 'bundle/src/main/.DS_Store'
rm 'bundle/src/main/resources/.DS_Store'
rm 'bundle/src/main/resources/META-INF/.DS_Store'
rm 'quotareport/src/main/kotlin/com/alibaba/alibrain/quotareport/.DS_Store'
將 .DS_Store 加入到 .gitignore
echo .DS_Store >> ~/.gitignore
更新項目
git add --all
git commit -m '.DS_Store banished!'
如果你只需要刪除磁盤上的 .DS_Store,可以使用下面的命令來刪除當前目錄及其子目錄下的所有.DS_Store 文件:
find . -name '*.DS_Store' -type f -delete
Kotlin 開發者社區
國內第一Kotlin 開發者社區公眾號,主要分享、交流 Kotlin 編程語言、Spring Boot、Android、React.js/Node.js、函數式編程、編程思想等相關主題。
Kotlin 開發者社區