In GIT I have 2 BRANCHES and a MASTER.
BRANCH1 is checked out from master and it have some commits to be merged with master and merging of BRANCH1 will take some time because of some testing reasons.
In that time I've to work on another Branch which is BRANCH2. So BRANCH2 should have the commits of BRANCH1 as I'll do some changes upon BRANCH1's commits, then BRANCH2 will also be merged with MASTER after sometime when BRANCH1 merged with the master (BRANCH1 will be merged first).
So What is the best option I can do for working on BRANCH2 with BRANCH1 change then merging it with MASTER?
Any suggestions are welcome and Thanks...
答案 0 :(得分:1)
无论何时准备合并branch2
,都应将其重新设置到branch1
上(如果branch1
尚未合并,或在master
上(如果{{ 1}}已被合并)
那样:
branch1
顶部重播branch2
提交来在本地解决冲突也就是说,开始情况:
master
一旦准备就绪,b1可能已经进化并合并到母版中:
m--m--m
\
b1 --b1--b1--b1
\
b2--b2
一个rebase --onto
就足够了:
m--m--m--m--m---------------M--m--m (master)
\ /
b1 --b1--b1--b1--b1 (branch1)
\
b2--b2--b2--b2 (branch2)
那么git rebase --onto master $(git merge-base branch1 branch2) branch2
m--m--m--m--m---------------M--m--m--b2'--b2'--b2'--b2' (branch2)
\ / (master)
b1 --b1--b1--b1--b1 (branch1)
会很简单