0 votes
1 view
in Azure by (32.3k points)

Is there a way to get a specific version (from a specific commit) of a file in Visual Studio 2015 - Team Explorer/Team Services Git?

I simply wish to run the solution with a previous version of a file just to see how things used to run and then come back to the latest version to continue development.

I did not create any branches. I kept on committing in the "master" branch.

1 Answer

0 votes
by (16.8k points)

In Visual Studio 2015, if you do View History (from the Actions menu on the Changes panel in Team Explorer):

View History

Then right click on the commit you're interested in:

Right Click

You can create a branch from there:

New branch

I cannot see a way to just checkout to the commit in Visual Studio.

Working with the command line you can do a checkout of the commit SHA you want to use:

git checkout 9eab01d9

When you are done, just check out master again:

git checkout master

You might get warnings about working on a detached head, in that case you could create a branch temporarily:

git checkout -b temp-branch-name 9eab01d9

It is a good idea to get comfortable with the Git command line, the Visual Studio tooling is coming along, but it misses a lot of features.

Welcome to Intellipaat Community. Get your technical queries answered by top developers !