1

I have the following commit structure:

a->b->c

Now c is an experiment, and it diverges significantly from b (to the point where any changes to b cause conflicts in c). I'd like to keep c, but want to stop maintaing the chain. Because there are so many conflicts between b and c, simple rebasing would be a bunch of work.

So I want to make

a->b
 \->c'

where c' is simply a copy of the workspace in c. In git I would use git reset --soft a and just make a new commit for my c', is there something equivalent I can do in mercurial?

IdeaHat
  • 7,641
  • 1
  • 22
  • 53

2 Answers2

2

Sounds like you want to use revert --all

pseudo commands (letters a,c mean revids of commits ):

  1. update -r a
  2. revert --all -r c
  3. commit -m "new c"
  4. strip -r c

a guide to using revert all using thg GUI can be found here

Tom
  • 6,325
  • 4
  • 31
  • 55
  • 1
    This is what I would do to. Except that the final strip is optional and/or you might want to wait to do that until later, just as a backup. You can undo a strip too but that's a little harder. – StayOnTarget May 08 '20 at 11:12
0

So I'm going to post what I ended up doing, but hope I get a better answer.

  1. Make a "do nothing" commit on a (in my case, I added a line). We need the fake because rebasing onto a from b will stop saying nothing to rebase.
a->b->c
\->f
  1. hg rebase -s b -d f --keep clones the whole branch:
a->b->c
\->f->b'->c'
  1. hg histedit, fold c' and drop f.
a->b->c
\->c''
  1. hg prune c
a->b
\->c''
IdeaHat
  • 7,641
  • 1
  • 22
  • 53