首页 > 其他 > 详细

git中避免提交.DS_Store文件[转载]

时间:2017-01-20 17:44:20      阅读:329      评论:0      收藏:0      [点我收藏+]

1. 先删除原有的.DS_Store:

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

命令解释:在当前文件夹以及当前文件夹的子文件夹中找到所有的.DS_Store文件,并将找到的文件通过管道传给xargs来处理。注意几个参数的理解: 
-print0:在find后不添加换行符(-print默认会添加换行符) 
-0:将管道送来的字符串当做普通的字符串,不做任何转义处理。

2. 建立.gitignore文件

vi .gitignore。然后添加.DS_Store作为忽略:

.DS_Store

3. 提交到git

git add .gitignore
git commit -m ‘delete .DS_Store‘

原链接:http://blog.csdn.net/nunchakushuang/article/details/50511765#

git中避免提交.DS_Store文件[转载]

原文:http://www.cnblogs.com/Candybunny/p/6323176.html

(0)
(0)
   
举报
评论 一句话评论(0
关于我们 - 联系我们 - 留言反馈 - 联系我们:wmxa8@hotmail.com
© 2014 bubuko.com 版权所有
打开技术之扣,分享程序人生!