Understanding GitHub and Visual Studio

Visual Studio is not only the best development IDE, but it also is the most convenient IDE. Microsoft keeps making things easier for developers who use Visual Studio. A perfect example of this fact is the addition of the GitHub Extension for Visual Studio, which is the best way to use Git in Visual Studio. Today, I will introduce you to the GitHub Extension for Visual Studio.

What Is GitHub?

GitHub is a Web-based version control, or Git repository and Internet hosting service. GitHub provides access control and several collaboration features such as bug tracking, feature requests, task management, and wikis for every project.

What Is Git?

Git is a version control system for tracking changes in computer files and coordinating work on those files among multiple people.

If you are new to GitHub, or are not sure how GitHub works, this great tutorial will help get you started.

GitHub in Visual Studio

To make use of GitHub from inside Visual Studio, you need the GitHub Extension for Visual Studio. To get this extension, follow these easy steps:

  1. Open Visual Studio.
  2. Click Tools.
  3. Click Extensions and Updates.
  4. Click Online.
  5. Search for GitHub.
  6. Select GitHub Extension for Visual Studio.
  7. Click Download.

Extensions and Updates
Figure 1: Extensions and Updates

It will prompt you to install, as shown next

VSIX Installer
Figure 2: VSIX Installer

Restart Visual Studio for the Extension to finish installing. Your Team Explorer tab will now show that you have access to GitHub, as shown in Figure 3.

Team Explorer
Figure 3: Team Explorer

As you can see, there are two sections dedicated to Gits and GitHub. GitHub is the Hub that is the hosting service for all the Gits, whereas Local Git Repositories shows all the Gits on your local machine.

To create a new Local Git Repository, follow these steps:

  1. Open the Team Explorer tab.
  2. Under Local Git Repositories, click 'New.'
  3. Give it a decent name, as shown in Figure 4.

    New Local Git Repository
    Figure 4: New Local Git Repository

  4. Click Create.

If you double-click the repository that has been created, Team Explorer will look like Figure 5.

Local Repository Team Explorer
Figure 5: Local Repository Team Explorer

Now, you can either create a new Solution or open a current Solution.

New Solution
Figure 6: New Solution

After you have done some changes to your project and are satisfied with your progress for the day, you can Commit the changes as shown next:

Commit Changes
Figure 7: Commit Changes

Or, you can Merge your Branches.

Merge Branches
Figure 8: Merge Branches

Or, Sync your changes to GitHub.

Sync Changes
Figure 9: Sync Changes

Publish to GitHub
Figure 10: Publish to GitHub

Figure 11: Published

You can go to GitHub with your browser and navigate to the given URL to see the project in action.

Figure 12: GitHub.com

This project doesn't do anything at all, but now other developers can contribute to this project's nothingness, or one day I can resurrect this project and do something decent with it. You can make changes inside the Web interface and obviously pull these changes into your Visual Studio solution.


GitHub is growing on a daily basis, and with Microsoft making it even easier to access your projects, or other projects through Visual Studio, it will keep on growing. I hope you have enjoyed this article. Until next time, goodbye!

This article was originally published on March 6th, 2017

About the Author

Hannes DuPreez

Hannes du Preez is a self-taught developer who started learning to program in the days of QBasic. He has written several articles over the years detailing his programming quests and adventures. .NET is his second love, just after his wife and kid. He has always been an avid supporter of .NET since the beginning and is an expert in VB and C#. He was given the Microsoft Most Valuable Professional Award for .NET (2008–2017). He has worked as a moderator and an article reviewer on online forums and currently works as a C# developer and writes articles for CodeGuru.com, Developer.com, DevX.com, and the Database journal.
His first book Visual Studio 2019 In Depth is currently on sale on Amazon and Bpb Publications.

You could reach him at: ojdupreez1978[at]gmail[dot]com

Related Articles

Close Icon
Thanks for your registration, follow us on our social networks to keep up-to-date