Monday, June 28, 2010

Merge between branches more than one level apart

Task: merge between trunk and branches that are more than one level away.

Setup:
trunk
|
|- branch1
|
|- branch2

Solution: When branch1 has been merged to trunk and the same changes have been merged from branch1 to branch2, and all revisions from trunk have been (nominally) merged to branch1 and branch2, it is possible to reintegrate branch2 in trunk without conflicts.

Example of procedure to reproduce this:

1) trunk with file readme.txt
2) trunk |branch> branch1
3) branch1: edit readme.txt
4) branch1 |branch> branch2
5) branch2: edit readme.txt
6) branch1: edit readme.txt
7) branch1 |merge reintegrate> trunk
8) branch1 |merge range of revisions> branch2
9) trunk |merge range of revisions> branch1
10) trunk |merge range of revisions> branch2
11) branch2 |merge reintegrate> trunk

No comments: