开发者

How can I revert a single file to a version I committed in Mercurial?

开发者 https://www.devze.com 2023-04-04 22:01 出处:网络
I have my index.cshtml file and I made a ton of changes to it. However, I want to scrap it and return to the a working (commited) version of this single file.

I have my index.cshtml file and I made a ton of changes to it. However, I want to scrap it and return to the a working (commited) version of this single file.

How can I use Mercurial to accomplish this?

I'm using 开发者_JAVA百科Visual Studio 2011 with VisualHG.


The command is called hg revert, you should be able to find something like that in VisualHg.

It looks like you already know what the command is named (since you used it as a tag). Is it not available in VisualHg? I would guess it's available in the context menu (i.e. right click) for the file.


Right-click on the file you want to revert and select "Revert Changes", this will show the revert window where you can see the file diff and perform the reversion by clicking the "Revert" button in the botom right corner.


Most of the times, when you make a lot of modifications to a file, you may find out that some of them are useful ( I do, at least ). Of course, for reverting the whole contents of the file, you should use revert as others have suggested. If however, you think you may have something useful in your current modifications, that you'd like to keep, consider using the record extension. It's an extension that ships with Mercurial, and it will allow you to choose whether or not you want to include some (c)hunks in your next commit.

0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号