Let's say I clone a remote Mercurial repository (over the local network or even over the Internet) to try something out.
I work in my clone, make a few commits...and then I realize that my changes don't make sense and I have to start over again.
So I want to have a "fresh" clone again, from the same source repository.
Basically, I want to "reset" my local repo to the point before I started experimenting.
What's the best / fastest way to do this?
The simplest way would be to just make a new clone, but then HG copies the whole repo and the whole history over the network again.
If the repo is really big, this will take some time and/or block the network.
I tried to make a new clone into the same folder (hoping that HG would recognize this and update only the files which have changed and the history) but that seems to copy the whole repo as well.
I could "hg rollback", but this rollbacks only the last commit. If I made several commits, I can only undo the last one. So I can't reset the repo to the point before I started committing.
Any ideas?
Is there really no other way than to clone the whole thing again?
(note: a solution with TortoiseHg would be nice...I prefer this over the command line)
You'll end us using hg strip
as gizmo suggests, but the traditional way to do this would be to clone again -- not from the remote repo, but from your own local repo. For example, if you checkout is 'repository' and you've added changesets 99 and 100 that you don't like you'd do:
cd ..
hg clone -r 98 respository repository-scrubbed
mv repository respository-with-crap-I-do-not-want
mv repository-scrubbed repository
That should be near instantaneous.
If you enable the Strip Extension, you can use the "hg strip" command that will remove the history you don't want anymore.
More information is available on the Strip command wiki page.
hg update -r <changeset number>
eg hg update -r 1
for the second version. You can use hg log
to see what version you want
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With