git推到一个是1个提交的存储库
我正在开发一个存储库,可以说我已经创建了一个提交“B”。 提交“A”是起源/主。它看起来像这样:
A -------------------- B
(origin/master) (HEAD)
但是其他人在我之前推送了一个提交(将其视为“Z”),并且不知道我在 B 之上创建了另一个提交,将其视为“C”。现在看起来是这样的。
(origin/master)
A --------- Z
\
\
-------- B -------- C
(HEAD)
如何首先拉取提交“Z”,然后推送本地提交。我可以确认 (Z) 和 (B, C) 是不相关的文件更改。我希望它们最终看起来像这样:
A -------- Z -------- B -------- C
(HEAD, origin/master)
我尝试过 git pull --rebase ,但没有用。让我知道如何重新启用它
I am working on a repository, where lets say I have created a commit 'B'.
Commit 'A' is the origin/master. It looks like this:
A -------------------- B
(origin/master) (HEAD)
But someone else pushed a commit (consider it as 'Z') before me, and without knowing that I created another commit on top of B, consider it as 'C'. It looks like this now.
(origin/master)
A --------- Z
\
\
-------- B -------- C
(HEAD)
How can I first pull the commit 'Z' and then push my local commits. I can confirm (Z) and (B, C) are unrelated file changes. I want them to eventually look like this:
A -------- Z -------- B -------- C
(HEAD, origin/master)
I have tried git pull --rebase
but no use. Let me know how can I re-enable it
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
实际上,
git pult -rebase
应该在此处工作,以达到您想要的a -z -z -b - c
分支。您也可以尝试明确的重置操作,然后进行推动:Actually,
git pull --rebase
should be working here to arrive at theA -- Z -- B -- C
branch you want. You could also try an explicit rebase operation followed by a push: