Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

In Visual Studio 2015 how to reverse/undo a commit in Git?

I have a commit done by a developer in the remote Git repository hosted in VSTS that needs to be rolled back. From Visual Studio, without going to the command prompt or how to revert the commit?

I want to undo the commit through Visual Studio without using a command prompt.

like image 277
Edvaldo Silva Avatar asked Aug 23 '17 19:08

Edvaldo Silva


People also ask

Can you rollback undo a commit?

To undo changes associated with a specific commit, developers should use the git revert command. To undo every change that has happened since a given commit occurred, use git reset.

How do I undo a revert in Visual Studio?

Visual Studio supports discarding uncommitted changes to a file by reverting the file to its last committed version. If the file is in the Changes section, right-click it and choose Undo Changes to discard all changes to the file since the last commit.


2 Answers

Selected answer is not correct. In order to undo a commit you need to select reset, not revert. Revvert will make a new commit with code contained in previous commit. Where reset will actually delete the commits after the selected version.

like image 55
AllenKll Avatar answered Oct 12 '22 06:10

AllenKll


Open the "Changes" tab in Team Explorer. Select "Actions", then "View History" to view the history of the repository. Identify the commit that you want to revert, right-click on it and select "Revert" from the context menu.

Revert

like image 32
Edward Thomson Avatar answered Oct 12 '22 04:10

Edward Thomson