Commit to Git in Visual Studio 2019
Tags: visualstudio, git, extension
Published: 2019-04-21 16:05:43

---
title: Commit to Git in Visual Studio 2019
published: true
description: This post explains how to use the Git Changes Window of the Git Tools/Git Tools 2019 Visual Studio extension. 
tags: #visualstudio #git #extension
---
[Visual Studio 2019]((https://docs.microsoft.com/en-us/visualstudio/ide/whats-new-visual-studio-2019?view=vs-2019)) was launched on April 2nd, 2019. I have migrated my [Git Tools](https://marketplace.visualstudio.com/items?itemName=yysun.GitTools) extension to a new extension, [Git Tools 2019](https://marketplace.visualstudio.com/items?itemName=yysun.git-tools-2019) in order to support the new asynchronous extension architecture of Visual Studio 2019.

Git Tools/Git Tools 2019 extensions add the Git Changes Window to Visual Studio to help you to create granular commits. This post explains how to use the Git Changes Window. 


#Install

Run Visual Studio 2019; select top menu "Extension"; search the Visual Studio Marketplace for Git Tools and install.

![install](https://thepracticaldev.s3.amazonaws.com/i/xq4h6u1xfobmi8wu1q2f.png)

You can select the menu "Extensions | Git Tools | Git Changes" to bring out the Git Changes Window.

![Git Changes Window](https://thepracticaldev.s3.amazonaws.com/i/kkrn7501wgab0057a9dg.png)


#Git Changes Window

The Git Changes Window displays the changes in the Git repository. &#10102; By clicking the changed files, the diff viewer on the right side shows the file content differences. &#10103; It lets you review the changes.

![Simple mode](https://thepracticaldev.s3.amazonaws.com/i/auirs5ju4otnj93ctivh.png)

You can double click the changes in the diff viewer. &#10103; It loads the changed file into the main code editor and navigates to the changed line. &#10104; It lets you adjust and refine your code. Once you are satisfied, you can select the file(s) &#10105;, enter comments &#10106;, and commit.

Step &#10102; to &#10106; completes committing code in the Simple Mode. The benefit of the Simple Mode is that it hides the concept of Git staging area/index, which makes it easier for beginners, as well as simplifies the commit workflow.

The Git Changes Window is modeled after the Pending Changes Window in Visual Studio 2010, which was unfortunately removed from [Visual Studio 2013](https://visualstudio.uservoice.com/forums/330519-azure-devops-formerly-visual-studio-team-services/suggestions/2654486-vs11-bring-back-the-old-pending-changes-window).

#Advanced Mode

The Git Changes Window also has the Advanced Mode. In the Advanced Mode, it displays both the changes and stages changes. &#10102; The diff viewer provides more menus. &#10103; It allows you not only to stage and un-stage the files but also to stage and un-stage the selected part of the files. As well as to reset/undo the selected part of the files. &#10104;

![Advanced mode](https://thepracticaldev.s3.amazonaws.com/i/vzxyz4pkio2fqr3ob20s.png)

The Git Changes Window is better than the out of the box Visual Studio Changes Page of the Team Explorer. The Git Changes Window is usually docked to the IDE to display the changes automatically. You can review and adjust the changes easily and create granular commits in Git. 

Creating granular commits is the primary goal of the [Git Commit best practices](https://github.com/trein/dev-best-practices/wiki/Git-Commit-Best-Practices). Git Tools/Git Tools 2019 extensions provide the nice Git Changes Window inside Visual Studio to help developers to archive the goal. The Git Changes Window is the unique feature of Git Tools/Git Tools 2019 extensions.

I only focused on the Git Changes Window and left out other Git features to be implemented by Visual Studio itself and other Git GUI Tools.

#Other Git Tools

If you have installed [Git Extensions](https://gitextensions.github.io) or [TortoiseGit](https://tortoisegit.org), you will see more menus to launch Git Extensions or TortoiseGit commands in the "Git Tools" menu and in the Git Changes Window. 

![Git-Ext](https://thepracticaldev.s3.amazonaws.com/i/cxkod5gsy3wrgzap9loh.png)
   

![Git-Tor](https://thepracticaldev.s3.amazonaws.com/i/bj6zccnth02jvksgng4v.png)

## Open Source Project

I developed the [first extension to support Git]
(https://www.infoq.com/news/2010/06/Git-Visual-Studio) for Visual Studio 2008/2010 when very few people believed that Git would become so popular as today. Eventually, Microsoft has supported Git officially since Visual Studio 2013. However, Git Tools/Git Tools 2019 still provides extra features and values to developers by enabling them to follow the Git commit best practices.

Git Tools/Git Tools 2019 remains as an open source project. You can find the source code from Github: https://github.com/yysun/git-tools.


Please [donate](https://www.paypal.com/cgi-bin/webscr?cmd=_donations&business=KBCLF3PZD6C98&lc=US&item_name=Git%20Tools%20for%20Visual%20Studio&currency_code=USD&bn=PP%2dDonationsBF%3abtn_donate_SM%2egif%3aNonHosted) or support the project on [Patreon](https://www.patreon.com/gittools). 👍❤️🙏

Have fun until next time.