美文网首页
使用git合并分支时.DS_Store和.xcuserstate

使用git合并分支时.DS_Store和.xcuserstate

作者: 路过独木桥 | 来源:发表于2018-03-23 09:43 被阅读0次

今天在合并项目代码时,.DS_Store和.xcuserstate文件冲突无法合并。需要移除忽略.DS_Store和.xcuserstate文件。

1.打开终端,切换到项目路径, 输入 cd 项目路径 ,

2.创建.gitignore文件,此文件可创建需要忽略的类型文件,执行  vim .gitignore,输入

.DS_Store*.xcuserstate

按ESC,在输入:wq保存退出

3.在命令行输入

git rm --cached *xcuserstate

git rm ---cached .DS_Store

按:再按wq退出编辑

4.执行

$ git add .gitignore

$ git commit -m "Remove and ignore .xcuserstate and .DS_Store files."

添加并提交文件

5.打开项目,解决其他项目文件冲突,合并代码

合并时可能会报

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 "add ."

git pull  origin master

git merge origin/master

成功解决!

参考资料:

https://stackoverflow.com/questions/21868857/removing-xcuserstate-and-ds-store-files-from-git

http://www.jianshu.com/p/4f69c79b295f

相关文章

  • 使用git合并分支时.DS_Store和.xcuserstate

    今天在合并项目代码时,.DS_Store和.xcuserstate文件冲突无法合并。需要移除忽略.DS_Store...

  • 终端使用:git

    1、使用git提交代码忽略的文件:.DS_Store、UserInterfaceState.xcuserstate...

  • git强制合并分支

    git A分支合并B分支,并强制使用B分支代码(不手动解决冲突) git A分支合并B分支,并强制使用A分支代...

  • Git 分支管理

    Git鼓励大量使用分支: 创建与合并分支 :查看分支:git branch创建分支:git branch

  • Git的分支(Branch)

    Git鼓励大量使用分支:因为创建、合并和删除分支非常快,所以Git鼓励你使用分支完成某个任务,合并后再删掉分支,这...

  • Git

    git命令合并分支代码 对于复杂的系统,我们可能要开好几个分支来开发,那么怎样使用git合并分支呢? 合并步骤:1...

  • Git 14合并分支

    合并分支 ========= 命令 git merge [name] 合并分支 分支名称 git branch -...

  • git常用操作

    git从已有的分支创建新的分支 git切换新的分支 git如何取消merge 当我们使用git merge操作合并...

  • Git merge 和 Git rebase 区别

    git merge 和 git rebase 均具有合并分支的效果,但合并分支的机理不同 Git merge gi...

  • 06_Git的分支的进阶与版本回退

    fast-forward:快进 如果可能,合并分支时Git会使用fast-forward模式 这种模式下,删除分支...

网友评论

      本文标题:使用git合并分支时.DS_Store和.xcuserstate

      本文链接:https://www.haomeiwen.com/subject/zfutcftx.html