Use Git Source Control with Visual Studio 2017

In this article I am going to explain How to Use Git Source Control with Visual Studio 2017.
Visual Studio is one of the best integrated development environment (IDE) from Microsoft.
It is used to develop computer programs, as well as websites, web apps, web services and mobile apps using Microsoft technologies like C#, VB, VC++ etc. languages.
Visual Studio uses Microsoft software development platforms such as Windows API, Windows Forms, Windows Presentation Foundation, Windows Store and Microsoft Silverlight.
It can produce both native code and managed code.
Git is a version-control system for tracking changes in computer files and coordinating work on those files among multiple people.
It is primarily used for source-code management in software development, but it can be used to keep track of changes in any set of files.
Visual Studio Comes with pre-installed component to support Git version control system.
If you are developing any app in Visual Studio, you definitely need to track the changes of files during development.
In this tutorial I am going to explain the process to integrate the git with visual studio and how to work on git in Visual Studio.

Use Git Source Control with Visual Studio 2017

  1. Login to your git account and create a new git repository.
    git repo
  2. Copy the URL of git project repository.
    git repo url
  3. Open visual studio and look for “Add to Source Control” on bottom right corner of Visual Studio.
  4. Click on that and select Git from menu, Selecting Git will open Team Explorer option.
    git in vs
  5. From Team Explorer window Click on “Publish Git Repo” Button, and paste the Git Repo URL from Step 2 and Press Publish Button (Shown in image according to order)
    publish git vs
  6. If asked for Credential, enter your git credential in Visual Studio Popup.
  7. And your code is published to git now, you can verify the published code by visiting your project repo on git.
  8. Now whenever you make changes in local file, it will be reflected in Changes Section of Team Explorer windows of you Visual Studio.
  9. To commit those changes to your project repo just, select “Commit All and Push” option and code will be committed to git repository.
    git commit vs

Watch this video for reference and live integration of git in Visual Studio.

If you have any doubts or query, just ask it on Ask Question Section.