在重新设置基础后要“拉”或“推”分支?

问题描述

我有一个过时但干净的test分支,我以master为基础。解决了一些冲突之后,我成功完成了一个变基过程。但是,git status现在告诉我分支testorigin/test已经分开,and have 37 and 15 different commits each,respectively.我想在重新设置基准后同步分支,因此我打算push,但现在还不确定,我不理解“ 37和15个不同的提交”背后的逻辑。

下一步是pull还是push

解决方法

您想强行推您的test分支。

在重新设置基准之前,您有这种情况:

--o-- 21 more commits --o     master
   \
    o-- 13 more commits --o   test and origin/test

重新设置基准后,您会遇到以下情况:

--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的后代。

相关问答

错误1:Request method ‘DELETE‘ not supported 错误还原:...
错误1:启动docker镜像时报错:Error response from daemon:...
错误1:private field ‘xxx‘ is never assigned 按Alt...
报错如下,通过源不能下载,最后警告pip需升级版本 Requirem...