Git for the .NET Developer: Part 1 – What’s the big deal about Git?

Git for the .NET Developer: Part 1 – What’s the big deal about Git?

If you are like most .NET developers, Team Foundation Server (TFS) and/or Visual Source Safe (VSS) have been your “go-to” tools for version control. With the recent growth of social coding, the integration of Git into Visual Studio, Git repositories offered as a service by Microsoft via Team Foundation Services, and the media coverage of Git… it seems destined that at some point someone on your team is going to be pushing Git as a source control option or you begin to feel the peer pressure to learn it. As the logical person you are, you question this motivation. I mean, TFS does what you need it to do, right?

I can’t say I didn’t feel the same way and, the fact of the matter, you are right…. TFS can get the job done just fine. So why even go through this pain of learning another version control system, especially one that will that make you pull your hair out if you try to learn it from purely one of the many GUIs that sits atop of it (more on this in a future post)? Unless it a requirement of your job, the answer really is “it’s your call”.

I won’t stop there and be a sell out. After finally becoming mildly proficient using it, I will present the larger benefits I have found as a .NET developer from knowing Git:

  • Git is a distributed version control system and is inherently setup for you to work offline. This means you have the entire version history on your local machine once you sync with a server, you are free to make commit changes locally as needed offline, and then you sync up with the server to share with the central repository when you are ready. The autonomy you get from this can feel liberating.
  • There are no exclusive file checkouts in Git. You are free to edit anything you want and when you sync with the server it auto-magically will merge your changes. That doesn’t mean merge conflicts go away, but it is great that you don’t have to deal with Bob not checking in the project file and is no where to be found.
  • Open source is more relevant than ever and Git is a major player in the scene. Knowing how Git works makes online social coding services, like Github, that much more relevant to your development experience. You are able to clone, sync, fork, contribute to, and easily access open source projects. The knowledge you learn from being interactive with open source projects, I believe, makes you a better developer. You may be thinking you are fine with only being able to download the zip file of the project?… refer to the next bullet point.
  • Git introduces you to new version control workflows. Git is very good at branching and merging. This combined with being a distributed version control systems introduces workflows that aren’t really practical using a central control system (e.g., TFS). An example is that it is common practice to develop in purely branches and then merge your updates into a central branch. The more popular of the flows are git-flow and GitHub Flow. The GitHub Flow is a great flow to start with. These flows get you thinking from different angles and become a tool for you to use when seeking to improve the quality of your code base, builds, and deployment.
  • Your command line skills get an upgrade. Installing Git for Windows comes with a bash command prompt, but you also have the option to use PowerShell. There are also GUIs for Git. However, for me, it is highly recommended to go with PowerShell and the Posh-Git module (explained more throughout this series). Git was a great excuse to learn more about PowerShell, which in turn, I have found so many other uses for in my day-to-day development (e.g., the Nuget Package Manager became my tool of choice for quick automation).

With these points, I do want to make it clear that, for me, Git never became the sole answer to version control systems – even though you will find religious debates from others that it is. I find Git to be a great tool but you should always consider the right tool for the job.

If you are still interested in learning Git, this series of posts is going to introduce how to get started using Git from a .NET developer’s perspective. When completed, you should be just dangerous enough using Git, avoid some of the pains I went through, and not be intimidated to start learning more. First, we need to setup a Git environment on your Windows machine… which will be the next post.