[英]To "pull" or "push" diverged branches after a rebase?
I've had an outdated, but clean test
branch which I rebased against master
.我有一个过时但干净的
test
分支,我根据master
。 After resolving a few conflicts, I successfully finished a rebase process.在解决了一些冲突后,我成功地完成了一个 rebase 过程。 However,
git status
now tells me that branches test
and origin/test
have diverged, and have 37 and 15 different commits each, respectively.
但是,
git status
现在告诉我分支test
和origin/test
有分歧,分别and have 37 and 15 different commits each, respectively.
I'd like to sync the branches after the rebase process, so I planned to do a push
, but not sure anymore, I don't understand the logic behind the "37 and 15 different commits".我想在 rebase 过程之后同步分支,所以我计划做一个
push
,但不确定了,我不明白“37 和 15 个不同提交”背后的逻辑。
What should be the next step, pull
or push
?下一步应该是什么,
pull
还是push
?
You want to force-push your test
branch.您想强制推送您的
test
分支。
Before the rebase, you had this situation:在 rebase 之前,您遇到过这种情况:
--o-- 21 more commits --o master
\
o-- 13 more commits --o test and origin/test
After your rebase, you have this situation:变基后,您会遇到以下情况:
--o-- 21 more commits --o master
\ \
\ o-- 13 more commits --o test
\
o-- 13 more commits --o origin/test
That is, you left origin/test
behind because you built your own branch on top of master
.也就是说,您将
origin/test
留在了后面,因为您在master
之上构建了自己的分支。 master
had 22 commits, and you built your 15 commits on top, that gives 37 commits. master
有 22 次提交,你在上面构建了 15 次提交,这给出了 37 次提交。 origin/test
remains at its 15 commits. origin/test
仍保持其 15 次提交。 And that is why git status
reports "37 and 15 different commits".这就是
git status
报告“37 次和 15 次不同提交”的原因。
At this point, you most likely want to publish your test
branch, ie push it to your remote repository.此时,您很可能想要发布您的
test
分支,即将它推送到您的远程存储库。 You have to force-push because the new head ( test
) is no longer a descendent of origin/test
.您必须强制推送,因为新头 (
test
) 不再是origin/test
的后代。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.