GIt-解决冲突

 

多人向仓库中push,就可能导致冲突。

比如比人把var sd = "wo shi 2222";已经push到仓库,而你本地没有,你只有这句var dd = "wo shi jinwei";想Push上去,就会报错

Updates were rejected because the remote contains work that you do not have locally. 
This is usually caused by another repository pushing to the same ref.
You may want to first integrate the remote change(e.g., 'git pull ...') before pushing again.
See the 'Note about fast-forwards' in 'git push --help' for details.

 

因为仓库中有的,你没有,所以有冲突,那么按提示Pull,也提示合并失败,打开冲突代码看,

Pulling is not possible because you have unmerged files.Fix them up in the work tree, and then use 'git add/rm <file>' as appropriate to mark resolution and make a commit.
fatal: Exiting because of an unresolved conflict.

 

<<<<<<<=======>>>>>>>这个会标志有冲突的代码。

=======之前的是你本地的,之后的是仓库中的,一般要是2个都可以存在,那就把这些标志去掉即可,然后编译,add,commit 再push一次.

 

 

 

 



posted @ 2020-03-06 10:45  JinweiChang  阅读(234)  评论(0编辑  收藏  举报