Daniel Farrell
Daniel Farrell

Reputation: 9740

Surgically removing commits in mercurial

I have accidentally committed multiple large data files (commits 3 and 4 in the example below) to my default branch in Mercurial and added commits on top without noticing. I want to surgically remove those commits. Fortunately, no code was touched in those commits so it should seem possible to easily remove them. I can't use Strip because it will remove all child commits too. How can I remove them?

For example, I want to remove revision 3 and 4 entirely in the screenshot below. You can find the example repository here in case it helps! Version control screenshot

Upvotes: 2

Views: 66

Answers (1)

Lazy Badger
Lazy Badger

Reputation: 97282

  1. Rebase last two changesets into some another location, strip unwanted changesets, return wanted back into DAG
  2. Generic case for "wanted and unwanted files in old changeset": install evolve extension, uncommit files

Upvotes: 2

Related Questions