
It’s not very long since Microsoft started support for using git with Visual Studio(since last year, 2013). Recently, it added some core updates to its GIT support, as mentioned on TechCrunch. I have not been using the visual studio/.NET platform for a while and thus wasn’t aware of the latest stuff. I explored this integration of git with Visual Studio recently in my free time, as I also was curious and missed a lot of this git feature when I used to work regularly.
I think most software developers who start their careers on the .NET platform might not have been aware of GIT recently unless they are personally motivated. But I hope this new integration will help a lot of developers start using this awesome version control system to manage their source code.
If you haven’t used git at all and just starting out, you should better get a little familiar. You can consider reading an old post of mine which is written specifically for using git on windows
Git Plugin Installation:
My installed Visual Studio is the Ultimate 2013 version, which is already shipped with it by default. If you don’t have or are using an earlier version(say, VS2 2012), you may consider downloading it from here.
Add Support For Git With Visual Studio Project:
When you create a new project, you should see an option at the bottom right corner that says ‘add source control system.’ Check this option. Later, you will have the option to specify a source control vendor.
Now, after adding test projects, etc., at the final stage, you will see two options on the source control selection dialogue. One is for git, and the other is for the Team Foundation Server. Select git here, and we should be just fine. This will also execute the git initialization command(‘git init’) in the background.
Cloning A Remote Repository:
If you are planning to use existing source code that might be on a remote git server, you will want to avoid creating new project steps and directly use the cloning option on Team Explorer. You should get it under Team Explorer -> Connect To Team Project and use the ‘clone’ button under the ‘Local Repositories’ section.
Basic Commit/Push Operations:
Commit:
Well, maybe you have some good coding going on, and now you have a stable state that you want to save. This means you want to commit some changes, you will just have to click on the ‘team explorer’ tab, put a small commit message and submit on the dialogue as in the screenshot below:
Remote Push/Pull:
As you should already know, committing isn’t enough here to send your changes to the server while using Git! Which also needs to be pushed to the remote server! To do so, you will have to use the ‘sync’ option on Team Explorer. As you might not have put any git remote address, you will get a field to enter that here:
View History/Revision Changes:
Until recently, you could access only the basic git features mentioned above. Now, you can see the code changes and compare them with a detailed history with Microsoft’s own CodeLens support. To get this support, you will need Visual Studio 2013 update 3. Now, let’s have a basic look.
Right-click on the file you want to see the history of and select the ‘view history’ option. This should bring you up with a summary history page as below:
Now, to see detailed code changes for a revision, select the revision, right-click and select the ‘compare with previous’ option. This should take you to a gorgeous view of the compare window as shown below:
What’s Next?
Get a try on github, currently the most popular collaborative open source software development platform.. To manage all your GitHub projects, you can consider using GitHub’s official Windows tool as well. Let me know if you have any questions/comments. Happy coding 🙂
Discover more from CODESAMPLEZ.COM
Subscribe to get the latest posts sent to your email.
Leave a Reply