Only recently, on version 1.8.2, git has added the long awaited pre-push hook. Windows received this feature as part of the 18.104.22.168 release since we don't get every new git release (as far as I understood). As I was already looking for a solution for compiling my .net code and running my unit tests every time just before I push my code, and making sure that if anything fails, the push is stopped, I already had some ruby code to do just that. When I heard the pre-push hook was available, I thought I could share that bit of code with other people looking for a similar solution. So I wrote a small ruby gem to do just that.
gem install pre_push
prepush [/r=test_runner:optional] [/td=path/to/tested.dll,path/to/another.dll:optional]
prepush /r=xunit191 /td=./MyProj.Tests/bin/MyProj.Tests.dll
/td=option, the test runner will run the tests of your solution. The gem will use the first sln file it finds under your repository. You can open the pre-push file inside .git/hooks and modify it as you wish.