I've found instructions on how to revert a single file in a Git repository to an earlier version. But I am curious if anyone knows of a way to do this using Git Extensions for Visual Studio. This tool works great so far and I really like it, but I can't figure out how to do this one thing.
To do the same in Visual Studio, right-click the commit you want to revert and then select Revert. After you confirm your action and the operation is complete, Visual Studio displays a success message and a new commit appears in the Outgoing section.
To revert changes made to a file in the working directory, just choose "revert changes" from the context menu in Visual Studio.
Locate the commit you want to revert in the Log tab of the Git tool window Alt+9 , right-click it and select Revert Commit from the context menu. This option is also available from the context menu of a commit in the file History view. The Commit Changes dialog will open with an automatically generated commit message.
The easiest way to do this in Git Extensions is to open the file history (e.g., from the context menu in Visual Studio) for the file you want to revert. Then find the revision you need and choose "Save As" in the context menu.
To revert changes made to a file in the working directory, just choose "revert changes" from the context menu in Visual Studio.
While the technique suggested by @Henk will work, here's the Git way.
Then you can unstage the file(s) that you do not wish reverted -- leaving only the one file that you do wish to revert to be committed.
While this might seem more tedious that just File > Save As, it comes in handy when you have to revert a handful of files.
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