我需要合併兩個分支 - second
到first
然後擺脫second
。下面是我所做的:爲什麼git不允許我安全地刪除分支?
git clone
d項目得到一個新的副本git checkout --track origin/second
,做了一些修改,並承諾git checkout --track origin/first
,做了一些修改,並承諾git merge second
(GIT說「合併由遞歸製造「)git branch -d second
然後git說:
$ git branch -d second
warning: not deleting branch 'second' that is not yet merged to
'refs/remotes/origin/second', even though it is merged to HEAD.
error: The branch 'second' is not fully merged.
If you are sure you want to delete it, run 'git branch -D second'.
爲什麼會發生這種情況?合併之前我從來沒有收到過這條消息。合併工作得很好,沒有衝突。我如何安全地刪除second
分支?
'git checkout second'跟着'git push origin second'讓git停止抱怨,但我不明白爲什麼。 –
一個瘋狂的猜測,但也許git抱怨說,在刪除它之前你沒有將'second'推到原點?還要確保你不在»分離頭«狀態 – knittl
@ knittl是的,你似乎是正確的,但爲什麼會關心我是否推「第二」? –