如何从Git存储库中删除.DS_Store文件? [英] How can I Remove .DS_Store files from a Git repository?

查看:286
本文介绍了如何从Git存储库中删除.DS_Store文件?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

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

How can I remove those annoying Mac OS X .DS_Store files from a Git repository?

推荐答案

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

Remove existing files from the repository:

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

添加行

.DS_Store

到文件 .gitignore ,它可以在你的仓库的顶层找到(或者如果它不存在的话就创建)。然后

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

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

这篇关于如何从Git存储库中删除.DS_Store文件?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆