How do you get a specific version of a file from git repository in Visual Studio 2017

Right-click the file in Solution Explorer and select View History. The Visual Studio History view will appear, showing the commits in your repo that updated the file. You can filter the commits to find the exact commit with the file version you want to restore. Double click on the version to open it in Visual Studio.

Retrieve deleted files in your repo by opening the Changes view in Team Explorer. Select View History from the Actions drop-down. Right-click the commit containing the version of the file you want to restore and select View Commit Details.

Right click the file to restore in the Commit Details in Team Explorer and select Open.

Save the version to your project by selecting Save As… from the File menu. If you save the file in your current project, either as a new file or overwriting an existing one, you’ll need to commit your changes to add the previous version to your local branch.

Add Comment