6

In Team Explorer it prompts me to install 3rd party git tools, I don't intend on using the Git command line, just Visual Studio's native GUI to clone, pull, commit, sync, merge and maybe issue pull requests.

So do I need to install 3rd party Git command prompt tools (or Github extension)? because I already installed 2.10.1 and didn't notice anything different. What do I gain if I do and what do I lose if I don't, because I want a clean minimal installation, and all tutorials and docs out there assume I have to install them.

VonC
  • 1,262,500
  • 529
  • 4,410
  • 5,250
Sami Ben
  • 536
  • 7
  • 22

2 Answers2

4

This might be in line with the recent tweet from Edward Thomson (also on Stack Overflow):

I don't mind @VisualStudio removing libgit2 and moving to git, they had good reasons but the "it acts different" excuse it reads like FUD.

There are good reasons for them to move to git: maintaining libgit2 in VS was a nightmare. (I know! I used to do it!)

And why pay to hack on (or around) libgit2 when they employ a Git for Windows maintainer?

He is talking here about Johannes Schindelin, who got employed by Microsoft last August 2015, and who is releasing the Git for Windows editions.

Totally makes sense for them to move.

So until recently, Visual Studio did not use a third party Git client, but now it does, with Visual Studio 15 (as commented by jessehouwing, VS 2015 doesn't come with its own git.exe, it uses a library instead).

This is Visual Studio 15 Preview 5 (not Visual Studio 2015 which is v14.25123.xx)
See ycombinator.com:

Seems a shame the "15" team have given up on libgit2. Considering Microsoft have / are a contributor and presumably all contributing parties have the same goal (cross platform, feature parity etc) one has to wonder what's so bad with libgit2 it's been dropped in favour of shelling out to git.exe?

By dropping libgit2, they freed up some memory. Obviously the overall memory usage of VS and git is probably increased but VS teams are flogged until memory usage decreases because nobody will prioritize making it a 64 bit app


The OP asks:

as a matter of fact I'm using VS "15" Preview 5. So does that mean I'll need to install Git for Windows or is it already shipped with VS 15? And if so why does it still prompt me to install it? – Jonney Shih 3 mins ago

jessehouwing answers:

A very minimal version ships with Visual Studio. But it's not added to the path. So Visual Studio doesn't rely on you installing it.

It's installed here: enter image description here

The best way to install a git client for your own command line escapades, is to install Git for Windows along side Visual Studio. If you've done so, you can dismiss the prompt from Visual Studio

Personally, I like to "install" Git simply by uncompressing the latest archive like: PortableGit-2.10.1-64-bit.7z.exe anywhere I want.

Community
  • 1
  • 1
VonC
  • 1,262,500
  • 529
  • 4,410
  • 5,250
  • @jessehouwing OK. I put that out there because if the Visual Studio 2015 tag. – VonC Oct 15 '16 at 13:45
  • Yes, I read about that on MSDN in the recent release note blog, as a matter of fact I'm using VS "15" Preview 5. So does that mean I'll need to install Git for Windows or is it already shipped with VS 15? And if so why does it still prompt me to install it? – Sami Ben Oct 15 '16 at 13:50
  • @JonneyShih No apparently it will ship with its own "Git for Windows" embedded in it. – VonC Oct 15 '16 at 13:54
  • @VonC VS15 and VS2015 are actually two completely different major releases. VS2015 under the hood carries major version number v14. Very confusing, I know. VS2015=v14, VS2013=v12, VS2012=v11, VS2010=v10. – jessehouwing Oct 15 '16 at 13:55
  • @jessehouwing Err... completely lost there. Which one are we talking about on this page? – VonC Oct 15 '16 at 13:56
  • @jessehouwing OK, I have added links to both to help differentiate them. – VonC Oct 15 '16 at 14:01
  • @jessehouwing This is the path it's installed in VS 15 `PROGRAMS\VS15Preview\Common7\IDE\Extensions\vzpa4ywg.wem\Git` I compared it with Git for Windows, the file structure is similar but it lacks many files and the overall size is 10 times smaller and it's 32 bit mingw. Why does it still prompt me to install the full one? – Sami Ben Oct 15 '16 at 14:24
  • Because it's only packing the bare minimum, no docs, no vi for merging, no nothing. – jessehouwing Oct 15 '16 at 14:28
  • On a separate note, anyone knows if there is any plans to resurrect the Source Sontrol Explorer or Solution Explorer to work with Git? @jessehouwing – Sami Ben Oct 15 '16 at 14:48
  • Solution Explorer works with git, not sure what you mean here. Source control explorer has been asked before and it may come, but I suspect it's lower on the list than som eof the other missing features, especially now that you can browse the repo structure locally in Windows explorer) and in TFS Web Access. – jessehouwing Oct 15 '16 at 14:53
  • @edward-thomson Could you please shortly elaborate on "maintaining libgit2 in VS was a nightmare"? – user1121956 Oct 08 '22 at 07:02
3

No you don't need a 3rd party git client (the Git for Windows should do). But some commands are not available through Visual Studio (yet), for example, you can't check the reflog and force-pushing is not available.

After installing Git For Windows, make sure its installation path is in your PATH environment variable and that you restart Visual Studio after installing it.

It is possible that Visual Studio won't detect it, if your version is much newer than what was available when your Visual Studio version shipped. In your case make sure you also have Visual Studio 2015 Update 3 installed.


Some background:

Visual Studio 2013 and 2015 ship with LibGit2 and LibGitSharp. LibGit2 is a library that implements most of the standard Git functionality in a cross platform C/C++ library. LibGitSharp is a managed wrapper around that. Not all commands are implemented directly in LibGit2, not everything LibGit2 is exposed directly in LibGitSharp.

The native integration has both advantages and disadvantages. While it's faster for some direct manipulation over shelling out to git.exe, it also makes the memory management much harder. Plus, any crashes or memory leaks in the native integration would slow down or take down the whole of Visual Studio.

By making the interaction with git out-of-process, each operation runs in its own little process and if that crashes or doesn't release its memory during execution, the command will fail, but Visual Studio will just see that git.exe is closing unexpectedly without it crashing too.

Also, by taking a dependency directly on git.exe, anything that's possible from the git command line is relatively easy to implement into Visual Studio, while in the past some features would not be available and would have to be coded in C# or in C++.


So, Visual Studio implements/exposes a number of git features directly, but some are not exposed. Features such as the RefLog, Force Push, Stash, Git Flow, Cherry Pick are not exposed though the Visual Studio UI at the moment. If you rely on these commands you will need an external git client. The commandline is the most universal example of such a client, but there are others that may help you out as well. GitKraken, SourceTree, Tower and others come to mind.

jessehouwing
  • 106,458
  • 22
  • 256
  • 341
  • I was also asking if I could do away with Git for Windows, I mean I could clone repositories and push commits just fine with VS alone. Is there any page that outlines what Git for Windows adds to Visual Studio precisely? – Sami Ben Oct 15 '16 at 13:38
  • Good, how does VS do that? does it ship with a subset of Git or what? And is there any page that outlines what Git for Windows adds to Visual Studio precisely? – Sami Ben Oct 15 '16 at 13:41
  • I'm not aware of a doc that shows what Git for Windows adds. The closest is probably the docs that show what Visual Studio does support, cross-compare that to the Git reference and you'll know what you're missing out on. https://msdn.microsoft.com/en-us/magazine/mt767697.aspx. There used to be a comparison for 2013, but 2015 added a number of features not available in 2013: https://msdn.microsoft.com/en-us/library/dd286572.aspx – jessehouwing Oct 15 '16 at 14:18
  • Thanks for the edit, it explains alot. I have Cherry-Pick in VS 15, so this must be a new feature introduced with the transition to Git, I just don't understand the prompt that always nags me to install Git for Windows. – Sami Ben Oct 15 '16 at 14:29