tl;dr Summary

Given Visual Studio 2013 has improved Git support, using Git on Windows is better than ever. Crucial ingredients are:

  1. Github for Windows
  2. Visual Studio 2013
  3. Honorable mention: SourceTree if you have bitbucket

Also, if you somehow still think Mercurial is “better for Windows”, it’s time to look again, Git has excellent support now.

Ingredient: having a Github and/or Bitbucket account

Yes. Bitbucket allows free private repositories; Github is Github.

Ingredient: Github for Windows

I almost recommend Github for Windows more for all the things it does for you during installation than anything after. Notably, Github for Windows:

  1. Creates a new private key and registers that key with Github. Double-clicking an installer is less stressful than worrying about US export controls when downloading an SSL provider to create my private key.
  2. Installs posh-git (which the start menu understands as “Git Shell”)
  3. Enables the handy “Clone in desktop” button on the github site.
  4. Gives you a GUI over your git repos. 
  5. Sets global settings for “difftool” to point to Visual Studio 2012, which is good…if you have VS 2012 installed. Anyway if you’ve read up on how to set custom git difftools and mergetools, you’ll be thankful.
  6. On new projects, creates reasonable .gitattributes and .gitignore files for .NET projects. I know there’s a forever war being fought over git’s CRLF settings, and Github for Windows is on the wrong side of that fight(* text=auto), but for the most part it’s good stuff.

Ingredient: posh-git

posh-git, the PowerShell git shell, is installed by Github for Windows. You can obtain it separately through chocolatey or by following the instructions at the posh-git project site.

Sure, you can still use git.exe on a cmd shell, but then you don’t get the fancy colors in your prompt or tab completion. You can also wear a blindfold while programming and program entirely by scent to present yourself with a challenge, I don’t want to tell you how to live your life. But, if you use the cmd shell when posh-git is installed, you’re doing it wrong. Not judging though.

Ingredient: Visual Studio 2013

Visual Studio 2013, which now has a working git source control provider. This means:

You can see when files have changed

Note the lock icons and the checkmarks next to each filename.

You can “diff” files from within Visual Studio

While this may not sound like a big thing to you, maybe you enjoy typing in hashes at the command line, maybe that’s your thing. For the rest of us:

I need to point out that the git diff command I posted above is nowhere near correct. The real command would have been way longer. For fun I tried to run the same diff from the command line…I gave up after 10 minutes.

I also need to point out that reading my commit log is so toxic that it may give you a rare bone disease. My commits were ugly, and I feel it’s important that you know that I am ashamed of them. For example, “Not 100% working” on a commit message is not a recipe for success.

Other things I haven’t used or aren’t available in the VS 2013 Preview build

There are a bunch of VS git integration features I didn’t use, like committing, undoing (checkout-ing?) changes, that may prove useful to others. Here’s some screenshots I collected (note this is the Preview build):


The Visual Studio team blog has a detailed, professionally-screenshot-adorned post explaining VS’s git support. Just stop reading once you get to the “team build” section, before you are exposed to an unfiltered view of a XAML-based build system. It’s not pretty. Like Gandalf tells Bilbo in the Hobbit 1 trailer, “…and if you do, you will never be the same.” Some things cannot be unseen.

Final words

And with that last parting shot at the build system, I’d like to wrap up. Git on Windows is better than ever. Most of the rough edges have been smoothed out, and the weird stuff you don’t understand probably wasn’t possible in TFS or SVN anyway.

This blog post was harvested from my monopoly-dotnet sample MVC project

I’ve put together a sample ASP.NET MVC 5 project implementing a portion of Monopoly, You may find browsing the source illuminating. I wrote the project to to explore ASP.NET MVC 5, automated web testing, singleton abuse, basic EF 6, and a few other things.

Get the source (or browse the source online):