You’ve probably heard all the hype about Git and why it’s an awesome version control system. Some of you have learned and embraced it while others have dismissed it. Afterall, it’s just version control, right? The way you’ve been doing it works for you (or not) and it is too much work to learn something new.
I must admit, that until about a year and a half ago I wasn’t doing a lot with Git. After all, I’ve successfully used Team Foundation Version Control (TFVC) for 8-9 years and frankly, it works great. So what was it about Git that made me decide to pick it up and master it? I guess I could tell you the typical argument about my ability to work disconnected and always having access to my full history. But in reality, I’m rarely disconnected. When I’m at home, I have internet. When I’m at the office, I have internet. When I’m at Starbucks taking care of my newly-found coffee addiction, I have internet. Even on a plane, I have internet (I’m writing this from about 30k feet somewhere over Colorado right now). So if someone tries to sell you on Git because of it’s disconnected virtues, tell them to try harder.
The thing I love about Git is the workflow that it enables for me. I really like the fact that I can commit as often as I want to without affecting the rest of my team until I am ready to push my code to the master repo. I wish I could tell you that I write perfect code the first time every time, but I don’t. I make mistakes (lots of them) and sometimes when my code gets to a stable point, I may not be ready to push that code to the rest of my team yet. So with TFVC (or any other centralized VC), I would have to just keep going (yes, sometimes I would shelve my code) and if I then did something that caused me to rethink my approach, I would have to pray that the Ctrl-Z gods were in my favor and that I would be able to get back to when my code was stable. And sometimes it worked…but many times it didn’t. So now I have to backtrack manually. Git allows me to commit over and over and over, every minute if I want to. And guess what, once I’m ready to push my changes to the master repo I can decide if I want the rest of the team to see all my commits or I want to turn all my local commits into a single commit and just push that.
The other awesome thing about Git is that it is widely used by people outside of the Microsoft stack, so collaborating with the rest of the world is much simpler if we are all using the same version control system. Git is accessible from command line and countless of tools.
Starting with TFS 2013, you can even choose Git as your source control repository when creating your Team Project. And no, this is not Microsoft’s version of Git, it is a full-blown Git repository, it just happens to be hosted by TFS and gives you all the team collaboration features that you’ve come to enjoy with TFS.
Git has gained a ton of popularity in the past few years and you’d be making yourself a huge disservice by ignoring it any longer. If you’ve lived in the centralized VC world, there is a learning curve and Git may seem a bit daunting at first, but don’t let it overwhelm you. There are a few commands that you need to get really familiar with to get your everyday tasks done: clone, Init, add, status, commit, checkout, branch, merge, push, pull, fetch.
If you want to get started with Git and be successful with it, while staying in Visual Studio, I created a Pluralsight course that you may want to check out: Git for Visual Studio Developers.