我有一个过时但干净的 test
我根据 master
重新调整的分支。解决了一些冲突后,我成功完成了 rebase 过程。然而,git status
现在告诉我分支 test
和origin/test
出现分歧,and have 37 and 15 different commits each, respectively.
我想在 rebase 过程后同步分支,所以我计划做 push
,但不再确定了,我不明白“37和15个不同的提交”背后的逻辑。
下一步应该是什么,pull
或push
?
最佳答案
您想要强制推送您的 test
分支。
在rebase之前,你遇到过这样的情况:
--o-- 21 more commits --o master
\
o-- 13 more commits --o test and origin/test
rebase之后,你会遇到这种情况:
--o-- 21 more commits --o master
\ \
\ o-- 13 more commits --o test
\
o-- 13 more commits --o origin/test
也就是说,您留下了 origin/test
,因为您在 master
之上构建了自己的分支。 master
有 22 次提交,您在上面构建了 15 次提交,总共有 37 次提交。 origin/test
保持在 15 次提交。这就是为什么 git status
报告“37 和 15 个不同的提交”。
此时,您很可能想要发布您的 test
分支,即将其推送到远程存储库。您必须强制推送,因为新头 (test
) 不再是 origin/test
的后代。
关于git - rebase 后到 "pull"或 "push" fork 分支?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/64170609/