Revert, then commit, then revert again

Steve Barnes gadgetsteve at hotmail.com
Mon Jan 7 19:39:00 UTC 2013


On 07/01/13 18:37, Samuel Sumner wrote:
> So I was working on a project in C++ that we had source controlled in 
> Mercurial. I eventually had made so many mistakes on the last 
> revision, that I wasn't getting anywhere so I reverted:
>
> hg update -r 23
>
> Then I made some successful changes, and committed normally.
>
> hg commit -u .....
>
> I still have a few minor mistakes, and in trying to solve them I 
> realize  I had written some code in the first tip (before the revert). 
> Is there any way to see the files from that revision? Or have the 
> changes been overwritten by the subsequent commit?
>
> Thanks.
>
>
> _______________________________________________
> Mercurial mailing list
> Mercurial at selenic.com
> http://selenic.com/mailman/listinfo/mercurial
No all your commits are there - that is in essence a major point of a 
revision control system - you can see what is there with hg log and you 
can get your whole source code tree back to any given revision with hg 
update N where N is the revision e.g. hg up 24 will take you back to the 
first commit after the point you "reverted" to.  Just make sure all your 
current changes are either committed or shelved before doing the update.

You can also update any individual file to a given revision or compare 
the contents of a given file with the current file. Reasonably easy to 
do with TortoiseHG or other graphical tools but possible from the 
command line if you need to.

One suggestion would be to do a local clone of your repository and have 
a play - if you get in trouble you can just delete the local clone and 
start again, (one of the joys of mercurial is the speed that you can do 
this at).

Gadget/Steve

-- 
Steve /Gadget/ Barnes
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.mercurial-scm.org/pipermail/mercurial/attachments/20130107/82410746/attachment-0002.html>


More information about the Mercurial mailing list