[英]How to rebase a branch to master while keeping the original commit history?
[英]How to rebase an upstream branch to master while keeping the merge histories?
鑒於上游功能分支是首先創建並從master分支出來的,因此其他分支一直在合並對其所做的更改。 現在,由於其他重要功能(此功能分支也需要此功能)而更新了母版,如何在保留所有歷史記錄的情況下,將該上游功能分支重新設定為最新的母版頭?
例如
---- changes merged to feature
/ \
+------+---- feature
/
----+---- master
現在
---- changes merged to feature
/ \
+------+---- feature
/
----+----+------+---- master
\ /
---- other features merged to master
要重新設置基數,以便不丟失對功能分支的更改歷史記錄
---- changes merged to feature
/ \
+------+---- feature
/
---------+------+---- master
\ /
---- other features merged to master
確認您具有git> = 2.19的版本(最好使用2.22),然后執行以下操作:
git checkout feature
git rebase --rebase-merges master
一個來源: https : //www.infoq.com/news/2019/07/git-2-22-rebase-merges/
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.