git学习- 解决文件冲突

error: failed to push some refs to'https://github.com×××××××××××××.git'
To prevent you from losing history, non-fast-forward updateswere rejected
Merge the remote changes (e.g. 'git pull') before pushingagain.   See the
'Note about fast-forwards' section of 'git push --help' fordetails.
root@Alps:/var/www/shopping# gitbranch 

遇到这个问题,找了好多, 大约是弄懂了一点点
其实这个问题就是, non-fast-forward会丢失修改!
就是需要远程和本地合并再push就对了

git fetch
git pull origin develop(假如你的分支是master,就写master)
这个时候可以再git push就好了,但是这里有个问题,就是gitpull的时候会自动合并分支,但是不一定一定成功
我就是遇到这个问题
CONFLICT (content): Merge conflict inregister_result.php
Auto-merging php_fns.php
CONFLICT (content): Merge conflict in php_fns.php
Auto-merging output_fns.php
CONFLICT (content): Merge conflict in output_fns.php
Auto-merging item-details.php
CONFLICT (content): Merge conflict in item-details.php
Automatic merge failed; fix conflicts and then commit theresult.

这么多文件冲突了,然后好吧。。。解决冲突:
直接的办法,编辑冲突文件:
your code is here
<< << << <</font> HEAD
another code is here
=======
also code is here
>>>>>>> 6853e5ff961e684d3a6c02d4d06183b5ff330dcc
在这里:<<<<<<<<HEAD和=======之间的文件是你的代码
============和>>>>>>>>>>>是别人的代码。
手动修改好了就行了!!

然后就可以gitpush了,再合并分支。
假如不熟练,本地偷偷备份一个就好了
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值