繁体   English   中英

Git:重新设立两个分支

[英]Git: Rebasing two branches

我有一个master并取得了分公司A 我提交了更改并推送到github,然后回到master并创建了一个分支B完成我的工作并推送到github。

我回到分支A ,进行了一些更改,然后意识到我需要分支B

在分支A我进行了git rebase B构建,并且对其进行了重新设置而没有问题。 我进行了一些更改,并使用master对其进行了重新调整,一切似乎都很好。

但是,现在,当我尝试推送到github时,我收到以下消息: Updates were rejected because the tip of your current branch is behind its remote counterpart. Integrate the remote changes (eg 'git pull ...') before pushing again. See the 'Note about fast-forwards' in 'git push --help' for details. Updates were rejected because the tip of your current branch is behind its remote counterpart. Integrate the remote changes (eg 'git pull ...') before pushing again. See the 'Note about fast-forwards' in 'git push --help' for details. 我不知道为什么,为什么现在落后呢?

我尝试了git pull但是没有用。 我应该做git pull origin A吗?

当您将分支A基于分支B ,您将重写 A的历史记录。 结果,当您推送时,Git抱怨说它不知道如何在本地A分支上应用新提交,因为该分支的基础已更改。 解决此问题的通常方法只是通过以下方式强制将A推到远程:

git push --force origin A

这将覆盖(读取:破坏者)远程服务器上的分支A 但是大概这就是您想要发生的事情。

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM