例子:合并一段commits
C0 - C1 - master
` C2 - C3 -C4 - feature_server
` C5 - C6 -C7 -feature_client
1. 把feature_client的C5 - C6 -C7合并到master
git rebase --onto master feature_server feature_client
master
|
C0 - C1 - C5` - C6` -C7` -feature_client
` C2 - C3 -C4 - feature_server
git checkout master
git merge feature_client
C0 - C1 - C5` - C6` -C7` -feature_client (master)
` C2 - C3 -C4 - feature_server
解释:
C:Commit的首字母
C`: Commit 的patch
C5,C6,C7 = feature_server feature_client
C2,C5,C6,C7 = feature_server~1 feature_client
2. 把feature_server的C2 - C3 -C4合并到master
git rebase master feature_server
feature_client (master)
|
C0 - C1 - C5` - C6` -C7` - C2` - C3` -C4` - feature_server
git checkout master
git merge feature_server
C0 - C1 - C5` - C6` -C7` - C2` - C3` -C4` - master
打赏
如果这篇文章解决了您的问题,让我买根烟抽抽。
支付宝.jpg 微信.jpg
网友评论