I am consistently impressed with Visual Studio Code. It’s light weight, it’s open source, it’s on OS X, Windows, and Linux, and it’s free. Whether the use case is having people on different platforms, and different hardware configurations, having the same experience, or simply avoiding the need to spin up a full IDE, VS Code gets things done. And it even supports Git out of the box! What’s not to like?
There is a minor quibble, though. If you’re running TFS locally, support isn’t there. It supports Visual Studio Team Services (the online version, formerly known as Visual Studio Online), but not the local version. Good thing there’s a simple fix.
Install Visual Studio Code
So, first things first, download and install Visual Studio Code. It’s an incredibly straight forward process, though I do want to point out one thing:
You may want to opt in on having the ‘Open with Code’ shortcut added to your context (right-click) menu in file explorer. This is a really useful way to open entire folders in code quickly.
So, you may be asking, what is the secret sauce for getting VS Code to work with a local TFS?
Install Git Credential Manager for Windows
Go through the install, picking your preferred settings, and watch for this one:
Git Credential Manager will be very useful.
Set up your git connection
Okay, so the easy stuff is out of the way, now for the other easy stuff.
Open up Git GUI (it installed with Git Credential Manager for Windows), and select Clone Existing Repository.
For source location, you’ll need the IP address/URL for your TFS server, as well as the path to the project. This happens to be the address when you’re looking at the Code tab in the TFS dashboard.
The target directory is where you want to host the files on your local machine. The result should look something like this:
At this point, you’ll be prompted for your TFS login credentials (watch out for the domain!).
After it’s all set up, navigate to the project, right-click on on the root folder and open in VS Code (you did set up the context options earlier, right?).
And with that, you have git access to your local TFS server. Now, all you need to do is figure out how to use VS Code’s built in git functions.