当 git pull 引起冲突但 git pull --rebase 不引起冲突时,这意味着什么?

发布于 2024-09-03 00:37:03 字数 830 浏览 5 评论 0原文

我正在从只有我有权访问的存储库中提取数据。据我所知,我只从一个存储库推送到它。有几次,我尝试推送它并得到了这个:

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 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

緦唸λ蓇 2024-09-10 00:37:03

这意味着当前的 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.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文