What is .DS_Store file

dsstore is a hidden file for custom attributes. The full name of dsstore is "Desktop Services Store". It is a hidden file created by Apple's Mac OS X operating system. The purpose is to store the custom attributes of the directory, such as the icon position of the files or the background color selection.

What is dsstore file?

dsstore is a hidden file for custom properties.

.DS_Store (English full name Desktop Services Store) is a hidden file created by Apple's Mac OS X operating system, the purpose is to store the custom attributes of the directory, such as the icon position of the files or the choice of the background color. Equivalent to desktop.ini under Windows.

delete.DS_Store

If there is no automatically generated .DS_Store file in your project, just add .DS_Store to the .gitignore file directly. If you already have a .DS_Store file in your project, you need to remove it from the project before adding it to .gitignore. as follows:

Delete all .DS_Store in the project. This skips .DS_Store not in the project

// 1、删除项目中的所有.DS_Store
find . -name .DS_Store -print0 | xargs -0 git rm -f --ignore-unmatch
// 2、将 .DS_Store 加入到 .gitignore
echo .DS_Store >> ~/.gitignore

update item

// 添加到暂存区
$ git add --all
// 提交到本地仓库
$ git commit -m '.DS_Store banished!'
// 推送网络仓库
$ git push origin main

If you only need to delete .DS_Store on disk, you can use the following command to delete all .DS_Store files in the current directory and its subdirectories:

find . -name '*.DS_Store' -type f -delete

Disable or enable automatic generation

Disable .DS_store generation:

defaults write com.apple.desktopservices DSDontWriteNetworkStores -bool TRUE

Restore .DS_store generation:

defaults delete com.apple.desktopservices DSDontWriteNetworkStores

Reference link:

Guess you like

Origin blog.csdn.net/sunyctf/article/details/128024626