Microsoft has announced that Visual Studio 2012 Update 2 will bring support in Visual Studio and TFS for git. They already used git on codeplex and this move shows how popular git has become. I don’t work much with git, but as I said codeplex uses git, and I used it for working on cpplinq. However, the experience with Git Source Control Provider extension for Visual Studio was not the most pleasant. Fortunately, Visual Studio Tools for Git is a different story, allowing you to work exclusively from Visual Studio, without the need of addition tools. After giving it a try, I must say that even if it’s in CTP and still has some issues, it’s a totally different story than the previous extension or external tools I used. However, support for git will not be added to the previous versions of Visual Studio.
Here is more about the support for git:
- Getting Started with Git in Visual Studio and Team Foundation Service
- Git init VS – Brian Harry
- Git support for Visual Studio – Git, TFS, and VS put into Context – Scott Hanselman
Before you can start working with git, you need two things:
In this post I’ll show what it takes to clone a git repository, work on the project, commit and push the changes on the remote branch.
To clone a repository you have go to Connect to Team Projects in Team Explorer, and under Local Git Repositories use the Clone pane to enter the URL of the server repository and the local destination. After the repository has been cloned, it shows up in the list, as shown below.
You can change the settings, such as your credentials from the Settings pane.
To view your changes you can use the Git Changes > Commits pane. You can see included and excluded changes, and also untracked files. To commit your changes, provide a description (mandatory) and hit the Commit button. The page updates after the commit finishes.
It is possible to view the changes on each file with the built-in tools:
After you committed all your changes and you’re ready to publish them on the server you can push the ongoing commits. If there are changes on the server, you must first pull those changes, merge locally, commit again and then push.
You can view the history for an entire branch from Team Explorer > Git Changes > Branches
or for a single file from Solution Explorer (it is also possible to compare two versions).