码迷,mamicode.com
首页 > 其他好文 > 详细

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

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

标签:com   article   commit   let   xargs   http   参数   git   --   

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文件[转载]

标签:com   article   commit   let   xargs   http   参数   git   --   

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

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!