tags:

views:

44

answers:

1

So working on a project recently (by myself - no other developers), I somehow managed to seriously bork the history with some (apparently) bad merges from cloned repositories.

What I would like to do - need to do - is fix this by just deleting the last 8 commits (according to hg glog)

Yes, I have made a few changes to the code after the borking began, however, only a few tweaks here or there - nothing I can't fix fresh from memory.

How can I get rid of the last 8 commits and start over from where I messed up?

+5  A: 

Make a clone of your repository - when you do this, you can specify the last commit that should be cloned.

So, if your repository has 100 changesets and you want to get rid of changesets 93 to 100, just do this:

hg clone -r 92 BadRepository CleanRepository

--> the CleanRepository will only contain changesets 1 to 92.

If you use TortoiseHG, you can do the same in the Clone dialog (there is a textbox "Clone to revision:")

haarrrgh