I'm working on a live server. I've updated to tip and it's caused problems: I need to revert back to a particular changeset (388) where things were OK.
I have no changes of any value on the server, the local changeset does not matter at all. In fact I actually want to kill any local accidental changes or merges so as not to confuse things.
How do I revert to a particular changeset and kill any local changes? Is it something to do with:
hg revert
---- UPDATE ---
To clarify, what I would like to do is first revert everything locally to changeset 388, and then ensure that my local repo is in such a state that when I do
hg status
I get no output. Otherwise I have a nasty feeling that when I next pull the tip, there will be conflicts to deal with - which I want to avoid, because the local changes are of no value.
---- UPDATE ---
For anyone else in this situation, what eventually fixed it for me was:
rm -rf <repo_dir> hg clone http://repository hg update -r 388
That will kill all your local changes, so proceed with caution (but that's what I wanted in this case).
If you want to revert just the latest commit use: hg strip --keep -r . Using strip will revert the state of your files to the specified commit but you will have them as pending changes, so you can apply them together with your file to a new commit.
Update sets the working directory's parent revision to the specified changeset (see hg help parents). If the changeset is not a descendant or ancestor of the working directory's parent and there are uncommitted changes, the update is aborted.
Just use the command below, to get to a revision.
hg revert -r REV
It's conflicting with --all.
To kill all local changes, --all should work.
hg revert --all
Don't use rollback
. It's a irreversible procedure, so should be used with care.
EDIT
You can update with --clean option. That will discard any uncommitted change. And then update to some changeset.
server: - .. - rev 386 - rev 387 - rev 388 - rev 389 clone to production -- testing stuff, it doesn't work! -- panic! -- rev 390 (in panic) -- rev 391 (in panic) -- cool down, thinking, need to go back to 388 -- one way: hg update -C -rev 388 (to keep 390, 391) -- other way: rm -rf dir (to discard 390, 391) -- hg clone http://server/hg -- cd dir -- hg update 388 -- testing, now works
There is also a wonderful Purge extension. Very solid stuff, it deletes all untracked files from working directory.
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