0

Steps:

  • Navigate with a browser to the github.com/user_name/repo_name/commits page
  • To the right of the desired repo click the far right <> button with the tooltip "Browse the repository at this point in the history."
  • Note the page just navigated has a URL like github.com/user_name/repo_name/tree/Some_UID
  • Click on the green "Code" button in the repo, then click "Open in Visual Studio".
  • After launching the MS VS Web Protocol Handler Selector from the popup dialog (with the "always allow Github to ..." checkbox), VS launches showing the Team Explorer dialog, with the URL of just the base repo (github.com/user_name/repo_name) in the remote URL box.
  • Attempt to replace the default URL with the desired commit (github.com/user_name/repo_name/tree/Some_UID) in the box and then click the Clone button.

The following message is generated at the top of the dialog:

Git failed with a fatal error. repository 'https//github.com/user_name/repo_name/tree/Some_UID/' not found

An empty directory with the name Some_UID is also created in the base repository directory.

Is there another way, preferably from the VS/Github GUI, of opening an older commit in Visual Studio?

Edit: The obvious solution is to open the Git history window in VS and right click on an old commit in order to revert to it. Given that Git Revert creates a new commit, which adds to the Git history chain,- the idea here was, in fact, to somehow open a new solution (in a different directory) with the old commit for quick testing, and delete it when finished. An idea which might seem feasible so long as the new (temporary) solution had no Git, or at least no bindings to Git that would point to the original solution.

Laurie Stearn
  • 959
  • 1
  • 13
  • 34
  • Related: [Checkout](https://developercommunity.visualstudio.com/idea/648233/i-want-to-be-able-to-git-checkout-an-old-commit-fr.html) as a feature in VS. – Laurie Stearn Nov 23 '20 at 09:22

1 Answers1

0

Clone the origin project.
Find the commit id, then reset to the id locally.
git reset --hard xxxxCommitIDxxxx

Sublele
  • 46
  • 4
  • Even glossing over the fact that the question is asking how to do this _in Visual Studio_, this is still wrong, because resetting is the wrong thing to do for this. They asked how to open the commit, not reset the branch to that commit. – Ryan M Sep 03 '20 at 10:14