P.Brian.Mackey P.Brian.Mackey - 1 month ago 14
Git Question

Switch between Git and TFS source control in visual studio

I'm in a situation where I need to run both TFS and Git side by side. I will need to switch between the two. Git is installed and configure to run locally. TFS is run on a company server. How do I switch between the two environments in Visual Studio 2013?

I am open to switching to VS 2015 if git integration has improved.

VS first detected Git and then switched over to that source control in "Team Explorer". I stumbled onto a way to switch to TFS (that I do not recall) and now I don't know how to switch back to Git.

If you care, I need to run Git side by side with TFS because I'm not allowed to create branches in TFS and there's no way I'm going to play around with commits in the Main trunk or manage N number of shelvesets. I'm going to use feature branches

Answer

If you want to use a TFS workspace and also use GIT then you can switch between them using Team Explorer. Hit the "plug" looking item at the top of the screen and you can switch between them there. The screen shot is from VS 2015 but the UI hasn't changed much from 2013

Team Explorer

If you want to use git exclusively on your local machine and but push to TFS on the server then take a look at "git-TF"

You can clone your "Trunk" from TFS to a local git repo, work exclusively in git and use feature branches etc. When your code is ready to send back to Trunk then you can rebase and push i.e.

git-tf clone http://myserver:8080/tfs/mycollection $/TeamProjectA/Trunk

Make changes to the file in the Git repo

git commit -a -m "commit one" (commit changes locally)

Make more changes

git commit -a -m "commit two"

git-tf pull --rebase

git-tf checkin