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
Git in Visual Studio, Azure DevOps Services, and TFS is standard Git. You can use Visual Studio with third-party Git services, and you can also use third-party Git clients with TFS. To learn more, see Git and Azure Repos.
The major difference with branching between Git and TFVC is that TFVC makes copies of the parent from which it branched while Git branches are just pointers to a commit. This can be a tough concept to understand. When TFVC creates a branch, it creates an entire copy of its parent. This ends up taking more space.
Git-TF is a set of cross-platform, command line tools that facilitate sharing of changes between TFS and Git. These tools allow a developer to use a local Git repository, and configure it to share changes with a TFS server.
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
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
Not the most elegant solution, but it's straightforward and doesn't require 3rd party tools (assuming you already have a git shell)... I simply rename the .git folder to something else before starting studio and it'll use TFS. As soon as the solution is open, you can then rename the git folder back to ".git" and do anything git-related via a bash shell.
mv .git git
(open the solution in VS)
mv git .git
At this point, you can check in/out using TFS through IDE, and push/pull using git via the shell.
NOTE: One thing you'll have to watch out for is if new files are added from the git side (ie, via a git pull) Studio will list them under "Excluded Changes > Detected: ### adds" so you'll have to "Promote" them.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With