Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to use a different Git version in Visual Studio 2017?

Git in Visual Studio is very slow for me. One of the things I try to fix this problem is to use the installed Git for Windows. Process Monitor shows Visual Studio keeps using the included Git version. My PATH variable contains

C:\Program Files (x86)\Git\cmd; 

but not

C:\Program Files (x86)\Microsoft Visual Studio\2017\Professional\Common7\IDE\CommonExtensions\Microsoft\TeamFoundation\Team Explorer\Git\mingw32\bin\git.exe

In Visual Studio External Web Tools options I pointed the previous two Git paths to their Git on Windows equivalent.

Visual Studio options External Web Tools

I'm using the following versions:

  • Visual Studio Professional 2017 version 15.6.4 (latest updates applied)
  • Git for Windows Git-2.16.2-32-bit.exe (latest version)
  • Windows 10 Enterprise 64 bit
like image 838
ofthelit Avatar asked Mar 28 '18 10:03

ofthelit


1 Answers

Instead of a full Git for Windows install, VS includes a MinGit install. MinGit is an official subset of the Git for Windows distribution and is available for download alongside the Git for Windows installers.

VS does this for several reasons. One reason to bundle MinGit is for reliable and predictable behavior. VS needs to parse the output of various Git commands, and not all commands have porcelain output available. That output changes from time to time, and the parsers have to be updated. By including MinGit, VS can verify the behavior of the commands it uses before each release. As an example, this happened with the 2.16 release of MinGit, which brought output changes in a handful of commands that we'll need to handle before moving to that version. Deleting the MinGit copy included with VS may break the Git integration.

A secondary reason is to cut down on the Git for Windows install size since it is several hundred megabytes. MinGit is under 50 megabytes.

like image 152
Chad B Avatar answered Oct 23 '22 05:10

Chad B