我有两个分支master
; branch1
和branch2
。我对branch1
进行了一些更改,并为此积极开展了PR活动。我还对branch2
进行了更改,这些更改已经过审查并合并到master
,并且随后删除了该分支。重新分支分支1与主分支2变化
我通过执行git fetch -ap
和git pull
更新了本地master
,这导致了branch2
中所做的更改。我现在想更新branch1
这些更改,以便唯一的区别是我在该分支上做出的区别。我试过git checkout branch1
,然后是git rebase master
。
然而,当我在branch1
做git status
它说:
On branch branch1
Your branch and 'origin/branch1' have diverged,
and have 3 and 1 different commits each, respectively.
(use "git pull" to merge the remote branch into yours)
做一个git pull
在这里开辟了一个合并注释对话框。但现在当我看到我的公关branch1
它现在包括从branch2
作为新变化的变化。这里发生了什么,我该如何解决这个问题?
谢谢你回答斯科特。只是为了澄清,我需要在哪个分支上运行'git push --force-with-lease'?我在'branch1'上运行了重置。 – MeanwhileInHell
'branch1'上的'git status'现在说 '在分支分支1上 你的分支由2个提交后面的'origin/branch1',并且可以被快速转发。 (使用“git pull”更新您的本地分支)' – MeanwhileInHell
@MeanwhileInHell更新我的答案以解决这两个意见。 –