如果系统中有一些配置文件在服务器上做了配置修改,然后后续开发又新添加一些配置项的时候,
在发布这个配置文件的时候,会发生代码冲突:
error: Your local changes to the following files would be overwritten by merge:
Please, commit your changes or stash them before you can merge.
如果希望保留生产服务器上所做的改动,仅仅并入新配置项, 处理方法如下:
git stash
git pull
git stash pop
然后可以使用git diff -w +文件名 来确认代码自动合并的情况.
反过来,如果希望用代码库中的文件完全覆盖本地工作版本. 方法如下:
git reset --hard
git pull
其中git reset是针对版本,如果想针对文件回退本地修改,使用
转自:http://blog.youkuaiyun.com/iefreer/article/details/7679631
git .gitignore 文件 解决二进制文件冲突问题
.gitignore 主要是添加 忽略文件 。最近团队开发经常出现
UserInterfaceState.xcuserstate 冲突,打开发现是二进制文件 ,没法解决冲突。
只好 rm -rf 之,次数多了真烦啦。
一劳永逸解决方案:
1,找到 .gitignore 添加 UserInterfaceState.xcuserstate 不纳入版本管理
2, 移除git 已经跟踪的UserInterfaceState.xcuserstate ,启用.gitignore 忽略对应文件
1),git rm --cached YourProjectFolderName.xcodeproj/project.xcworkspace/xcuserdata/myUserName.xcuserdatad/UserInterfaceState.xcuserstate
2),git commit -m "Removed file that shouldn't be tracked"
3),git clean -f -d
http://stackoverflow.com/questions/6564257/cant-ignore-userinterfacestate-xcuserstate
推荐个 iOS 常用的 gist :https://gist.github.com/mmorey/6931793
本文介绍了解决Git中配置文件合并冲突的方法,包括保留服务器上的更改并合并新配置项,以及如何用代码库文件完全覆盖本地版本。此外,还提供了解决二进制文件冲突的具体步骤。

被折叠的 条评论
为什么被折叠?



