当 git pull 引起冲突但 git pull --rebase 不引起冲突时,这意味着什么?
我正在从只有我有权访问的存储库中提取数据。据我所知,我只从一个存储库推送到它。有几次,我尝试推送它并得到了这个:
To [email protected]:tsched_dev.git
! [rejected] master -> master (non-fast-forward)
error: failed to push some refs to '[email protected]: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.
一般来说,这只是意味着我必须执行 git pull (尽管所有更改应该可快进)。当我执行 git pull 时,我会遇到冲突。如果我执行 git pull --rebase ,它就可以正常工作。我做错了什么?
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 [email protected]:tsched_dev.git
! [rejected] master -> master (non-fast-forward)
error: failed to push some refs to '[email protected]: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?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
这意味着当前的 origin/master 和当前的 master(与您自己的提交)不兼容,但是如果您自上次更新以来获得了更改并将它们放在您自己的提交之前,则会导致非冲突状态。
基本上这取决于您如何排序有冲突的提交。通过变基,您可以将原始数据放在您的数据之前,而通过合并,您可以将原始数据作为一个整体来对抗您的主人,这可以产生影响。
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.