0

I have such a history of commits:

[A] - [B] - [D] - [F] - [H] - [I]
        \     \        /
        [C] - [E] - [G]

How do I get the following story:

[A] - [B] - [D] - [F] - [H] - [I]
        \              /
        [C] ------- [G']

where [E] - is a merge commit.

Nikitron
  • 87
  • 1
  • 1
  • 6
  • Can I ask why you need to remove it? This will also affect every descendent of `[E]` (e.g. `[H]` -> `[H']` and `[I]` -> `[I']`). – Edward Oct 25 '13 at 13:44
  • I just want to leave this branch work that has been done in this branch. Indeed, in `[H']` merge will be different, but the state of the repository will be exactly the same as in `[H]`. So `[I]` will not change. – Nikitron Oct 25 '13 at 21:00
  • 1
    `[I]` may _functionally_ be the same as `[I']` but the hash that hg uses to identify it will be different, so to hg it is a 100% new changeset. Any modifications you make to history locally will need to be redone on _every_ repo that has that version of history. This is why history is generally considered immutable and messing with it is discouraged. – Edward Oct 25 '13 at 21:34

1 Answers1

0

In your illustration both E and H are merge commits. If you want to display just A, B, C, D, F, G, I then you'd do:

hg log --no-merges

If you mean actually modify history, then that's almost certainly a mistake. In your second drawing G' contains the "work" represented by D but does not have D as an ancestor, that means when you merge it back the merge will be done with the wrong most-recent-common-ancestor (really it'd D but it'll launch with A) and become a hairball.

Ry4an Brase
  • 78,112
  • 7
  • 148
  • 169