Git 变基到多个修订集
Git rebase onto with mutliple revision sets
我们正在使用 git rebase --onto
来选择从一个分支到另一个分支的提交。为简单起见,我们假设从开发分支到发布分支。
1----A----B----C----D----2----3----E----F---G----H----4----5----6 develop
除上述之外,我需要将开发中的所有 "character" 修订合并到发布中,重要的是要注意我需要忽略数字修订。
所以我们所做的是 运行 每个分组的变基。例如在上面有 2 个分组,A 到 D 和 E 到 G。
git rebase --onto release 1 D #rebase the first range of revisions from the develop branch and base it on the release branch
git rebase --onto release 3 H #rebase the second range of revisions from the develop branch and base it on the release branch.
问题是对于每个分组我们都需要运行这个命令,这很不方便。
有什么方法可以 运行 git rebase --onto
一次,然后在一个命令中指定所有需要的修订
Is there any way that I could run git rebase --onto once and specify all the required revisions then in one single command
我建议改用 git cherry-pick
。
将 cherry-pick
与 commit range
一起使用,您可以传递任意数量的范围
# set the range of commits you are interested in
# A should be older than B.
cherry-pick A..D E...H
它会将给定的范围合并到您当前的分支中
我们正在使用 git rebase --onto
来选择从一个分支到另一个分支的提交。为简单起见,我们假设从开发分支到发布分支。
1----A----B----C----D----2----3----E----F---G----H----4----5----6 develop
除上述之外,我需要将开发中的所有 "character" 修订合并到发布中,重要的是要注意我需要忽略数字修订。
所以我们所做的是 运行 每个分组的变基。例如在上面有 2 个分组,A 到 D 和 E 到 G。
git rebase --onto release 1 D #rebase the first range of revisions from the develop branch and base it on the release branch
git rebase --onto release 3 H #rebase the second range of revisions from the develop branch and base it on the release branch.
问题是对于每个分组我们都需要运行这个命令,这很不方便。
有什么方法可以 运行 git rebase --onto
一次,然后在一个命令中指定所有需要的修订
Is there any way that I could run git rebase --onto once and specify all the required revisions then in one single command
我建议改用 git cherry-pick
。
将 cherry-pick
与 commit range
一起使用,您可以传递任意数量的范围
# set the range of commits you are interested in
# A should be older than B.
cherry-pick A..D E...H
它会将给定的范围合并到您当前的分支中