Reputation: 4909
I have an issue while using Bazaar and I would like to get the best practices to fix it. Here is the context:
In the trunk of our project, one wrongly merged a branch (BranchA) in the trunk but he used revert on most files while keeping the merge info (so from bazaar BranchA was effectively merged in trunk, preventing to REALLY merge it later).
The merged revision was committed as r4.
After this (undesired) merge, many devs committed right after (r5 & r6).
So my question is : how to undo this wrong merge ? (while keeping the commits after).
I tried to uncommit back to r3 and merge each rev from r4 to R6 (omitting r4)
I tried 'reverse cherry pick' r4 ... but the BranchA merge information may still memorized.
trunk
|
r6
|
r5
| branchA
| |
r4 ---+
| |
| r2.2
| |
r3 r2.1
| |
r2 ---+
|
r1
If you have a solution or some clue to fix it, please share it !
(for example can REBASE command help here?)
Upvotes: 2
Views: 311
Reputation: 124694
Since information was lost due to the reverts in the merge that has gone wrong, there won't be a 100% fix. Your best bet is to create a new branch off of r3
in the trunk
and cherry pick r5
and r6
, like this:
cd /path/to/repo
bzr branch trunk -r3 branchX
cd branchX
bzr merge -c5 ../trunk
bzr commit -m "cherry picked r5: $(bzr log --line -r5 ../trunk)"
bzr merge -c6 ../trunk
bzr commit -m "cherry picked r6: $(bzr log --line -r6 ../trunk)"
Or, before cherry picking r5
, you might want to merge from branchA
the "right way".
The rebase command won't help you here. The purpose of rebasing is basically to reorder revisions: whether you merge or rebase, you end up with the same content in the files, only the revision history graph will have a different shape. The purpose of rebase is usually to make a history graph look flat, which can be neat, but it's only cosmetics, in terms of content the end result is the same.
Upvotes: 2