3 回答

TA貢獻1906條經驗 獲得超10個贊
A?rebase --onto
如果在集成分支的頂部重放給定的提交范圍,將更好,如查爾斯·貝利.
(此外,請查找“這里是如何基于一個分支將主題分支移植到另一個分支”的git重基手冊頁的實際例子git rebase --onto
)
如果您當前的分支是集成的,那么:
#?Checkout?a?new?temporary?branch?at?the?current?locationgit?checkout?-b?tmp#?Move?the?integration?branch?to?the?head?of?the?new?patchsetgit ?branch?-f?integration?last_SHA-1_of_working_branch_range#?Rebase?the?patchset?onto?tmp,?the?old?location?of?integrationgit?rebase?--onto? ?tmp?first_SHA-1_of_working_branch_range~1?integration
它將在以下幾個方面重播所有內容:
- 在父母之后
(因此first_SHA-1_of_working_branch_range
):你想要重播的第一次提交~1
- 直至“
“(指向要重播的最后一次提交,從integration
支部)working
致“tmp
“(指的是integration
指過去)
如果其中一次提交被重播時有任何沖突:
- 要么解決它,然后運行“
git rebase --continue
". - 或者跳過此修補程序,而是運行“
git rebase --skip
" - 或者用“
“(然后放回git rebase --abort
支線integration
支部)tmp
在那之后rebase --onto
,?integration
將返回到集成分支的最后一次提交(即“tmp
“分支+所有重放提交)
摘櫻桃或者rebase --onto
,不要忘記它對隨后的合并有影響,如在此描述.
純“cherry-pick
“并涉及以下內容:
如果您想使用修補程序的方法,那么“git格式-修補程序\git是”和“git櫻桃”是您的選擇。
目前,git cherry-pick
只接受一次提交,但如果要選擇范圍B
貫通D
那就是B^..D
用吉特林戈語,所以
git?rev-list?--reverse?--topo-order?B^..D?|?while?read?rev? do? ??git?cherry-pick?$rev?||?break?done
但是無論如何,當您需要“重放”一系列提交時,“重播”一詞應該促使您使用rebase
“Git的特征。

TA貢獻1826條經驗 獲得超6個贊
git cherry-pick
學會選擇一系列的提交(例如: cherry-pick A..B
和 cherry-pick --stdin
),也是 git revert
這些不支持更好的測序控制。 rebase [-i]
盡管如此。

TA貢獻1796條經驗 獲得超7個贊
git format-patch A..B git checkout integration git am *.patch
--3way
git-am
- 3 回答
- 0 關注
- 972 瀏覽
添加回答
舉報