Undo a wrong merge with Bazaar

TRIDENT JOB trident_job at hotmail.com
Mon Jun 30 19:51:28 UTC 2014


Thx for sharing your plugin benoit.I 'rewrite the history' doing it by hand ... just to fully understand what I've done.I will test your plugin to see the difference.Thx again.

> Date: Thu, 19 Jun 2014 21:39:12 +0200
> Subject: Re: Undo a wrong merge with Bazaar
> From: benoit.pierre at gmail.com
> To: trident_job at hotmail.com
> CC: bazaar at lists.canonical.com
> 
> On Thu, Jun 19, 2014 at 8:56 PM, TRIDENT JOB <trident_job at hotmail.com> wrote:
> > Hi BZR community !
> 
> Hi,
> 
> > 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?)
> 
> I fear rewriting history is really the only solution here, which of
> course mean that you must do it sooner rather than later since every
> developer will have to overwrite its copy of the old branch with the
> new one. If you are interested I have a personal plugin that I made
> and used to use intensively (I don't use Bazaar anymore) that can make
> it easier to interactively rewrite history (it's based on how "git
> rebase -i" work): you can get it here:
> https://code.launchpad.net/~benoit.pierre/+junk/bzr-rewrite_interactive
> 
> With this plugin installed, you can (I assume you're using a
> lightweight checkout, starting from trunk):
> 
> - make a backup copy: bzr branch . ../trunk.bak
> - go back to r3: bzr pull --overwrite -r 3 .
> - rewrite the missing history from backup: bzr rewrite ../trunk.bak
> 
> You can either keep r4 if there are some changes to keep (merge info
> will be lost, so you will be able to merge branchA again), or just
> remove it by deleting the corresponding line.
> 
> Cheers,
> 
> -- 
> A: Because it destroys the flow of conversation.
> Q: Why is top posting dumb?
 		 	   		  
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.ubuntu.com/archives/bazaar/attachments/20140630/429b5c3b/attachment.html>


More information about the bazaar mailing list