
It’s not much long Microsoft started support for using git with Visual Studio(since last year, 2013). And now, recently, it added some core updates on its git support as mentioned on techcrunch. I am not using visual studio/.NET platform since a while and thus wasn’t aware of the latest staffs going on. I explored this integration of git with visual studio recently on free time, as I also was curious and did miss a lot of this git feature when I used to work regularly.
I think most of software developers who starts their career in .NET platform, might not aware much of git recently unless personally motivated. But I hope this new integration will help a lot to the developers to 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 ultimate 2013 version, which already shipped with it by default. In case you don’t have or using 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 right bottom corner that says ‘add source control system’, check this option. You will get option to specify source control vendor later on.
Now after adding test projects etc, at the final stage you will see two option on source control selection dialog. One is for git, another is for team foundation server. Select git here and we should be just fine. This will also execute git initialization command(‘git init’) in background.
Cloning A Remote Repository:
If you are planning to use an existing source code which might be on a remote git server, then 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 ‘Local Repositories’ section.
Basic Commit/Push Operations:
Commit:
Well, may be you have some good coding going on and now you have a stable state that you want to save. Which 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 dialog as like the below screenshot:
Remote Push/Pull:
As you should already know, committing isn’t enough here to send your changes to server while using git! Which also need to be pushed remote server yet! To do so, you will have to use the ‘sync’ option on team explorer. As you might haven’t put any git remote address, you will get a field to enter that here:
View History/Revision Changes:
Until recently, you were able to only the basic git features as mentioned above. Now, you can see the code changes/compare with detailed history with Microsoft’s own CodeLens support. To get this support, you will need visual studio 2013 update 3. Now, Lets have a basic look.
Right click on the file you want to see history of, select ‘view history’ option. This should bring you up with a summary history page as below:
Now, to see detailed code change for a revision, select the revision, right-click and select ‘compare with previous’ option. This should take you to a gorgeous view of compare window as like 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 official tool for windows as well. Let me know if you have any questions/comments. Happy coding 🙂
Leave a Reply