Make the Git GUI appear after you publish a Web Project in Visual Studio 2010
A couple of months ago I started to use GIT as my primary Source Control. To be honest I hadn’t used any “real” source control at all before for this project. I only used an online backup service that had some basic version control on a file-to-file basis.
But I love GIT. It’s really simple and everything works more or less exactly as you expect it to do. But there aren’t many tools out there that integrate well with Visual Studio. There are Git Extensions for Windows and there is a project called Git Source Control Provider. The problem with Git Extensions is that it doesn’t do that much. It only adds a menu in Visual Studio where you can execute some commands. Git Source Control Provider on the other hand looked like the perfect tool for me. But for some reason, it didn’t sync correctly with my Git Repository and I got the feeling the project was a bit too immature to be trusted.
I always forget to commit
So, my biggest problem is that I always forget to fire up the command line / GUI and commit the changes I do to the code. When you use SVN, TFS you get those nice little icons on all the files in Visual Studio so you are constantly reminded of your changes. This was what Git Source Control Provider promised but as I said, didn’t work for me.
I would be happy just to be reminded every time I publish my website to the FTP that “Hey! Don’t forget to commit your changes!”. And just to be clear. This is a solution for a one-man shop that doesn’t need “continuous integration” and loads of complicated stuff. I like my super simple solution where I just publish my project to my FTP and boom done!
My stupid hack
I found this post on Stack Overflow that explains how to run an MS Build target after you do a publish from Visual Studio. You just have to add this target at the end of your .csproj file. Your publish method must be a “WebDeploy”. I tried with “File System” but that didn’t work. The “WebDeploy” method was much faster anyway.
That’s more or less all there is to it. This will fire up the GIT GUI and your Publish task won’t finish until you close that program. Of course, you could probably just run the console instead if you prefer that.