Reverting to a previous commit in Git for visual studio 2012

In Team Explorer -> Branches then select Actions -> Open command prompt and use the git commands either:

  • git checkout your commit id
  • git reset your commit id

check this out to understand the difference What's the difference between "git reset" and "git checkout"?

I think you'll also need to have git extension installed in Visual Studio, I have it, but not sure it's required to do that.

enter image description here


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.


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.


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