Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
461 views
in Technique[技术] by (71.8m points)

macos - 如何从Git存储库中删除.DS_Store文件?(How can I Remove .DS_Store files from a Git repository?)

如何从Git存储库中删除那些烦人的Mac OS X .DS_Store文件?

  ask by John Topley translate from so

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Answer

0 votes
by (71.8m points)

Remove existing files from the repository:

(从存储库中删除现有文件:)

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

Add the line

(添加行)

.DS_Store

to the file .gitignore , which can be found at the top level of your repository (or created if it isn't there already).

(到.gitignore文件中,该文件可以在您的存储库的顶层找到(或如果尚未存在则创建)。)

You can do this easily with this command in the top directory

(您可以在顶层目录中使用此命令轻松完成此操作)

echo .DS_Store >> .gitignore

Then

(然后)

git add .gitignore
git commit -m '.DS_Store banished!'

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...