在多人合作的项目里,git pull origin master执行完之后出现以下问题:

Auto-merging .DS_Store CONFLICT (content): Merge conflict in .DS_Store Automatic merge failed;

原因是.DS_Store这样的文件在项目提交时需要忽略掉。

忽略步骤:

1、touch .gitignore 创建一个文件,

open -e .gitignore 把配置内容粘贴上传,然后保存。(内容是https://www.gitignore.io/gitignore网站里输入 Mac os  objective-c cocoapods xcode即可以获取到)

git add .

git commit

然后要全局使用这个 .gitignore

$ git config --global core.excludesfile ~/.gitignore

后面跟的是 .gitignore文件位置。你可以更改。但是那个路径下 必须存在那个配置文件。

2、手动或者命令行删除完  .DS_Store之后,执行一下命令:

rm .DS_Store

git add .

git commit -a -m “更改内容”或者git commit -am是前者的简写

git pull origin master

git push origin master

执行完之后 其他同事需要合并我的代码,如果同事有内容提交,执行一下命令:

git add .

git commit -a -m “修改的内容"

git pull origin master

git merge origin/master执行此命令之后出现以下错误:

error: merge is not possible because you have unmerged files.

hint: Fix them up in the work tree, and then use 'git add/rm '

hint: as appropriate to mark resolution and make a commit.

fatal: Exiting because of an unresolved conflict.

出现此错误后重新执行

git add .

git commit -a -m “ssss”

git pull  origin master

git merge origin/master

然后再执行下面

git push origin master

至此GitHub上就不会再有.DS_Store了成功的表现是:本地有.DS_Store和gitignore文件就可以了,GitHub上有.gitignore 没有 .DS_Store文件。

文/小木偶的(简书作者)
原文链接:http://www.jianshu.com/p/4f69c79b295f
著作权归作者所有,转载请联系作者获得授权,并标注“简书作者”。

最新文章

  1. Python Beautiful Soup学习之HTML标签补全功能
  2. C++ 队列的实现
  3. android项目中配置NDK自动编译生成so文件
  4. android-ListView控件的使用
  5. Fragments碎片
  6. CI框架篇之控制器篇--设置路由(1)
  7. 解决Maven中Missing artifact javax.jms:jms:jar:1.1:compile
  8. Hibernate介绍
  9. abiword rtf 解析
  10. Codeforces 842A Kirill And The Game【暴力,水】
  11. Spring AOP梳理
  12. 运用正则+replace+substring将一段英语的字母大写 angurlar运用自定义指令filter完成首字母大写
  13. springboot学习随笔(二):简单的HelloWorld
  14. POJ 3162.Walking Race 树形dp 树的直径
  15. 如何查看IntelliJ IDEA的版本信息
  16. 内网IP外网IP的关联及访问互联网原理
  17. oracle java连接配置
  18. Cheatsheet: 2017 06.01 ~ 06.30
  19. ES6读书笔记(一)
  20. 用opencv做的静态图片人脸识别

热门文章

  1. 【代码笔记】iOS-自定义switch
  2. ActiveReports 报表应用教程 (15)---报表换肤
  3. DrawerLayout建立侧滑时,显示侧滑页面,底层页面仍可以有点击响应,解决办法。
  4. Cookie、Session 和 Token区别
  5. markdown简单常用语法
  6. kafka入门2:java 创建及删除 topic
  7. sql 经典面试题及答案(选课表)
  8. [Visual Studio] [Config] [Transformation] [SlowCheetah] 在非Web工程中使用Transformation
  9. java8时间操作
  10. PHP学习第一天