Reverting to a previous commit in Git for visual studio 2012

Solution 1:

Visual Studio 2015 Update 2 adds support for GIT "Reset", which is what you probably want to do:

  • open history
  • right click the commit you want to revert to
  • reset -> reset and delete changes

GIT Reset in Visual Studio 2015 Update 2

Solution 2:

You don't want to do a revert - revert just takes a commit and undoes it.

If you want to go back to a previous commit - there are two options:

If you want to permanently go back, do a git hard reset, which rolls back the code to a specified commit. You can do this via:

git reset --hard {commit number}

If you want to temporarily go back, you can create a branch from that commit. which will essentially keep you current path in the code history, and create another path from the point in history where that code was committed.

Solution 3:

Well to those newbies who have the same problem, the best way not to waste 3 hours of your life is simply not to use visual studio tool for GIT. At least not in its current form.(23 Jun 2013)

After wasting much time i found out from an obscure link that the vs extension only supports a few of the GIT function with reset not being one of them.