git没有冲突 但是提示有_Git没有显示任何冲突,并且正在覆盖我的本地副本

bd96500e110b49cbb3cd949968f18be7.png

My routine on git has always been very simple:

git add -A

git commit -m 'the changes I made'

git pull

# resolve conflicts

git push

However, for some unknown reasons, despite lots of conflicts with the origin, after pulling, I don't get any conflicts and without my permission it force updates my local copy. Something along these lines: '2 files changed, 2 insertions(+), 6 deletions(-)'. But in my case, conflicts shouldn't be resolved from simple merge and should require manual conflict resolution from my side. Why is git not letting me to do the manual conflict resolution? Thanks in advance!

note: none of my git commands have force option -f

解决方案

git pull without argument is, more or less, equivalent to git fetch && git merge origin/. By using pull instead of fetch and merge, you're allowing git to attempt the merge into your local branch. If that merge occurs without conflict, your local will look "force updated" because it was able to sort out the differences between the remote's version of your files and your own, without your intervention.

Debugging what's happening is sort of hard without seeing your code, but try this:

git fetch ;# fetch the remote changes

git diff HEAD origin/ ;# diff your local branch with the remote's copy of

The output from git diff should clue you into what's happening. If you'd like to follow it even further, try git merge --no-commit origin/, then issue git diff --cached. That'll show you exactly what changes git merged automatically, and should allow you to determine what's what.

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值