Reverting to a previous commit in Git for visual studio 2012

I am really new to git and source control.

I am using visual studio tools for git with vs2012.

  • Git versus Mercurial for .NET developers?
  • Is there a Subversion API that can be used to program against in .NET
  • Version Numbers float, decimal or double
  • Does anyone know of a good C# API for Subversion?
  • What is the optimal way to organize shared .net assemblies in SVN?
  • Handle multiple components in one or several Git repos?
  • I am on some commit and want to go back to some previous commit but i cannot seem to do it how. When i go to the commit details the revert button seems to have been grayed out.

    I have stuck on this problem for the last 2 hours. I have researched the internet but to no use. Please can somebody tell me how to revert to a previous commit.

    Thanks.

  • can git send-email send diff patch of html format?
  • how to push certain files to repository
  • configuring user and password with git bash
  • File permissions restore in Git
  • Git Merging Branch Into Master
  • Git list : viewing git repositories in home folder
  • 4 Solutions collect form web for “Reverting to a previous commit in Git for visual studio 2012”

    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:

    GIT Reset in Visual Studio 2015 Update 2

    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.

    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

    Git Baby is a git and github fan, let's start git clone.