如何将所有提交从一个分支移动到另一个分支? [英] How to move all commits from a branch to another?
本文介绍了如何将所有提交从一个分支移动到另一个分支?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
$ b
X1 - X2 - X3 - X4 - X5 - X6 )
\
D1 - D2 - D3(dev)
\
B1 - B2 - B3(bug1)
我想将所有从
X1 - X2 - X3 - X4 - X5 - X6 - B1 - B2 --B3(master)
\
D1 - D2 - D3(dev)
最好的选择是什么?
http://linux.die.net/man/1/git-rebaserel =noreferrer> git rebase --onto
git rebase --onto master dev bug1
git checkout master
git merge bug1#fast-forward merge
另见 ProGit Book 为另一个 rebase --onto
的例子。
The scenario is this:
X1--X2--X3--X4--X5--X6 (master)
\
D1--D2--D3 (dev)
\
B1--B2--B3 (bug1)
I want to move all commits from bug1 branch to master branch and get rid of bug1 branch. In this case:
X1--X2--X3--X4--X5--X6--B1--B2--B3 (master)
\
D1--D2--D3 (dev)
What's the best option to do this?
解决方案
It should be a classic case of git rebase --onto
git rebase --onto master dev bug1
git checkout master
git merge bug1 # fast-forward merge
See also the ProGit Book for another example of rebase --onto
.
这篇关于如何将所有提交从一个分支移动到另一个分支?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文