user3905553
user3905553

Reputation: 5

Removing merge with ancestor

I have a mercurial repo of the followng form:

... 27-28----------------------38-39 ... tip
         \__ 29 __ ... __ 37__/

as you can see, I have accidently merged 37 into 28, creating 38. How can I fix this, so that I get a simple linear history like the follwing:

... 27-28-29-...-37-39-...tip

Upvotes: 0

Views: 39

Answers (2)

Vince
Vince

Reputation: 3577

If it is not pushed yet, the easiest is to rebase 39 (and descendants) on top of 37, and simply strip changeset 38.

You'll get your linear history, but as @Ry4an said, "embrace" the fact that your history will not be linear, otherwise it will just make you unhappy...

Upvotes: 1

Ry4an Brase
Ry4an Brase

Reputation: 78330

There's no easy way to do this. You could probably use the convert extension to rebuild the repository with that history using the --branch-map argument and manually stitching it together as you'd like, but it'll invalidate all existing clones, change the hashes, and be a pain to do. Don't fetishize a linear history -- anonymous branches and merges are part of a normal DVCS workflow. Embrace it.

Upvotes: 1

Related Questions