将特征分支转移到另一个特征分支上 [英] Rebase feature branch onto another feature branch
问题描述
a - b - c< p< ; - 硕士
\\\
\ d - e < - Branch1
\
f - g < - Branch2
在稍后处理这些分支后,我发现我需要Branch1中的Branch2中的更改。我想将Branch2中的更改重新映射到Branch1上。我想结束以下内容:
a - b - c < - Master
\
d - e - f - g < - Branch1
我很确定我需要将第二个分支重新绑定到第一个分支,但我不完全确定正确的语法以及我应该检出哪个分支。
这个命令能产生想要的结果吗?
(Branch1)$ git rebase --onto Branch1 Branch2
切换到分支Branch2
git checkout Branch2
然后用branch1
git rebase Branch1
这会让您满意导致Branch2像这样
a - b - c < - Master
\
d - e - f - g < - Branc h2
您可以删除Branch1
I have two (private) feature branches that I'm working on.
a -- b -- c <-- Master
\ \
\ d -- e <-- Branch1
\
f -- g <-- Branch2
After working on these branches a little while I've discovered that I need the changes in Branch2 in Branch1. I'd like to rebase the changes in Branch2 onto Branch1. I'd like to end up with the following:
a -- b -- c <-- Master
\
d -- e -- f -- g <-- Branch1
I'm pretty sure I need to rebase the second branch onto the first, but I'm not entirely sure about the correct syntax and which branch I should have checked out.
Will this command produce the desired result?
(Branch1)$ git rebase --onto Branch1 Branch2
Switch to the branch Branch2
git checkout Branch2
Then do a rebase with branch1
git rebase Branch1
Which would leave you with the desired result in Branch2 like this
a -- b -- c <-- Master
\
d -- e -- f -- g <-- Branch2
You can delete Branch1
这篇关于将特征分支转移到另一个特征分支上的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!