In Mercurial I have an old changeset which is all good apart from the alterations to a single file. How would I revert the alterations to that single file?
Even just being able to view the state of the file at the previous changeset would be good then I could cut & paste.
My Mercurial client is TortoiseHg.
To revert a file to a specific changeset, use hg revert -r CHANGESET FILENAME . This will revert the file without committing it.
hg revert changes the file content only and leaves the working copy parent revision alone. You typically use hg revert when you decide that you don't want to keep the uncommited changes you've made to a file in your working copy.
As of TortoiseHg 2.8.1
Raghuram's answer is no longer correct due to stylistic(~) changes to TortoiseHG. "Repository Browser" has been renamed "TortoiseHG Workbench", but, more importantly, "Revert file contents" is no longer an action on the context menu.
As of version 2.0.4, you'll want to:
The first time I tried this, I'm not sure what I did wrong, but I reverted the whole repository instead of the single file. So, definitely make sure you commit a new revision before trying it.
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