WEBINAR: On-demand webcast
How to Boost Database Development Productivity on Linux, Docker, and Kubernetes with Microsoft SQL Server 2017 REGISTER >
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:
- Open Visual Studio.
- Click Tools.
- Click Extensions and Updates.
- Click Online.
- Search for GitHub.
- Select GitHub Extension for Visual Studio.
- Click Download.
Figure 1: Extensions and Updates
It will prompt you to install, as shown next
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.
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:
- Open the Team Explorer tab.
- Under Local Git Repositories, click 'New.'
- Give it a decent name, as shown in Figure 4.
Figure 4: New Local Git Repository
- Click Create.
If you double-click the repository that has been created, Team Explorer will look like Figure 5.
Figure 5: Local Repository Team Explorer
Now, you can either create a new Solution or open a current 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:
Figure 7: Commit Changes
Or, you can Merge your Branches.
Figure 8: Merge Branches
Or, Sync your changes to GitHub.
Figure 9: Sync Changes
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!