Revert, then commit, then revert again

Kevin Bullock kbullock+mercurial at ringworld.org
Mon Jan 7 20:24:14 UTC 2013


On Jan 7, 2013, at 12:37 PM, 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

And did you commit any of these changes?

> 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?


If you had committed before the update -r23, those changes are still in the repository. You can:

- see the heads of both lines of development with `hg heads`
- see the graph of branches with `hg log --graph`
- update to the other head with `hg update REV`, where REV is the local revision number or changeset ID you found with `hg heads`,
- merge the two branches together with `hg merge REV`

Etc. See one or more of:

http://mercurial.selenic.com/wiki/Tutorial
http://mercurial.selenic.com/wiki/QuickStart
http://hgbook.red-bean.com
http://hginit.com

pacem in terris / мир / शान्ति / ‎‫سَلاَم‬ / 平和
Kevin R. Bullock




More information about the Mercurial mailing list