Git rebase --onto用法

命令:git rebase --onto [Branch]  [commit_id1]  [commit_id2]

用法:有两个branch分支(branchA 和 branchB),需要将branchB中的某几个commit 合并到branchA中。

        1、分支checkout到branchB

        2、执行命令:git rebase --onto [branchA]  [commit_id1]  [commit_id2],此时branch处于游离状态(可以使用git branch查看分支)

        3、执行命令:git checkout -b [new_branch] ,得到一个新分支new_branch,此分支即为想得到的分支

        4、将new_branch合并到branchA上,即完成

          

你可能感兴趣的:(Git rebase --onto用法)