Of course, you can click on a commit 2 times and the files that have been changed will appear in Team Explorer, but this is not very convenient. Is it possible to "replace" the state of a project with a state of a commit, just to see what and how it was at that time, without deleting other commits and creating new ones?

enter image description here

  • I have found one option so far: PCM for commit - View details (commit details), in the window where commit details appear, open Actions (in Russian most likely actions) -> Copy Commit ID, then go to the GIT console - and do git checkout < commit ID> - A1essandro
  • @ A1essandro, if you find another option (besides checkout ) - be sure to write to Torvalds, please the old man with new unexplored features. (This is a joke. Of course, I know about show , cat-file , and even more sophisticated ways, but “canonical” is, of course, only checkout ). - aleksandr barakin
  • I tried using the Git Extention program to roll back a branch to a specific earlier commit. He rolled back, opened the project, his state did not change at all, only red daws were added for some files. s17.postimg.org/f7t9dfw0f/image.png - Drovosek
  • @alexanderbarakin, even did not understand the joke. Even if you google (I don't work with git very often, mostly mercurial) "go to a certain commit git", it gives a checkout. Explain, please, if I'm wrong. - A1essandro
  • @EgorSpiriadi, most likely you just rolled back the changes (i.e. made revert githowto.com/ru/undoing_committed_changes ) - A1essandro

2 answers 2

If the task is to just see the commit without creating new ones or rolling back through the commit tree, then the simplest thing is to create a separate branch. Right-click in Visual Studio on the current branch (bottom right of the window) and select View History ... A tab with a commit tree will appear.

We right-click on the right commit and select New Branch ... (all changes of the current branch must be closed, otherwise it will not be possible to switch to it after creating a branch). After you have worked with the new branch, you can delete it in Team Explorer (after switching to another branch).

    The solution to the problem was found thanks to Pavel Goroshkov here: https://vk.com/wall-38655318_37990

    In Visual Studio itself, this will not work. I installed the Git Extensions program and opened the repository / folder with the Visual Studio project in it. They chose a commit, PCM on it and chose "Roll back the current branch here" and in the appeared window select "Hard: ......"

    enter image description here enter image description here

    • one
      Similarly, in the studio "Reset -> With the removal of changes (hard)". - Monk
    • Without losing commits, but with switching the working directory - in the screenshot, the button "Switch to revision". Just what you advised in the comments. In the studio, I did not find a similar button. - Monk
    • and git checkout? Ie go to the desired repository and git checkout with the identifier of the desired commit. - QuaternioNoir