git只合并某一个分支的某个commit

第一种情况:只合并一个commit

git checkout develop-hbb
git cherry-pick 7c32be61

以上,7c32be61是develop上的一个fix bug的commit,上面就是将这个commit合并到develop-hbb上

第二种情况:合并连续的多个commit到指定的分支上

比如在develop分支上有7c32be61到54dfef55的连续的10个commit,54dfef55是后面的提交。先在要将这10个commit 合并到develop-hbb分支上

1)首先基于develop分支创建一个临时分支temp,并指明新分支的最后一个commit

git checkout -b temp 54dfef55 

2)将temp分支上的从7c32be61到最后一个commit,也就是54dfef55的commit合并到develop-hbb上

git rebase --onto develop-hbb 7c32be61^

猜你喜欢

转载自www.cnblogs.com/boshen-hzb/p/9764835.html