What does it mean when git pull causes a conflict but git pull --rebase doesn't?

雨燕双飞 提交于 2019-12-10 10:59:02

问题


I'm pulling from a repository that only I have access to. As far as I know, I've only pushed to it from one repository. A couple of times, I've tried pushing to it and gotten this:

To jbaker@192.168.2.216:tsched_dev.git
 ! [rejected]        master -> master (non-fast-forward)
error: failed to push some refs to 'jbaker@192.168.2.216:tsched_dev.git'
To prevent you from losing history, non-fast-forward updates were rejected
Merge the remote changes before pushing again.  See the 'Note about
fast-forwards' section of 'git push --help' for details.

Generally, that just means that I have to do a git pull (although all the changes should be fast-forwardable). When I do a git pull, I get conflicts. If I do a git pull --rebase, it works fine. What am I doing wrong?


回答1:


It means that current origin/master and current master(with your own commits) are not compatible, but that if you got the changes since the last update and put them before your own commits it leads to a non-conflicting state.

Basically that depends how you order the commits you have conflicts. With a rebase you put the origin ones before yours, with merge you put the origin ones as a whole against your master, that can make a difference.



来源:https://stackoverflow.com/questions/2874268/what-does-it-mean-when-git-pull-causes-a-conflict-but-git-pull-rebase-doesnt

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!