.gitignore all the .DS_Store files in every folder

2019-01-29 14:37发布

I've added .DS_Store to the .gitignore file, but it seems that it is only ignoring .DS_Store in the root directory, not in every folder and subfolder.

How do I fix this?

标签: gitignore
8条回答
你好瞎i
2楼-- · 2019-01-29 15:20

You can also add the --cached flag to auco's answer to maintain local .DS_store files, as Edward Newell mentioned in his original answer. The modified command looks like this: find . -name .DS_Store -print0 | xargs -0 git rm --cached --ignore-unmatch ..cheers and thanks!

查看更多
Explosion°爆炸
3楼-- · 2019-01-29 15:25

Step :1)Remove the existing files using this command

find . -name .DS_Store -print0 | xargs -0 git rm -f --ignore-unmatch

Step : 2)Add .DS_Store in your .gitignore file

Step :3) Commit your changes in .gitignore git add .gitignore git commit -m "removed .DS_Store"

查看更多
登录 后发表回答