I joined GitHub in June of 2012, just to see what the fuss was all about. It wasn’t until today that I had my first pull request accepted and merged, and it was that feeling of having contributed to something that others may find useful that inspired me to write this post. The inspiration doesn’t come from the contributing part. Don’t get me wrong. I’ve contributed and collaborated before. It was, rather, this new social way of controlling and tracking code, changesets, and comments that really make GitHub… cool.
Origins & Centralized Code Control
My origins with source code control stemmed from the days of Microsoft Visual SourceSafe 6.0. Back in those days, you mention a pull request, and people would probably think you are trying to solicit questionable services/acts. I retroactively learned CVS and Subversion because it was open source (read: free), and hence, preferred by my university’s CompSci department. Outside of the world of academia though, it’s been SourceSafe, followed by TFS. These are centrally managed and were the perfect model for the teams I worked in. Check in, check out, the occasional branch/merge… keeping it simple. Now, slightly alter the code contribution model from 10 people to 100, and it becomes close to impossible to manage the above operations when they need to happen in parallel.
This is where the need comes to break up the centralized model into a distributed one. This type of community-style code contribution actually is not new. Linux was built by a community. Interestingly enough, it was using a proprietary source control system, right up until 2005 when Mr. Linux himself, Linus Torvalds, came up with Git.
// Quick distinction
Git = protocol;
GitHub = social site for code sharing via Git;
You may run a private git code repository, or you may use GitHub for cloud hosting/sharing your code.
If you are engaging in a distributed model of code sharing/contribution, you should strongly consider Git / GitHub. During my 9 to 5, I’m all about TFS. It fits my team model. It integrates. It’s wonderful. For open source code sharing and contributing to libraries, I’m using GitHub.
Now, instead of just throwing a glossary of terms at you, let me take you through the process of a pull request (PR) so that you can get better acquainted through example. To start, I forked the original module code that was in someone else’s GitHub repository. When you think about the distributed model, all that means is I placed a copy of it in my GitHub repository. I could have cloned it, which is just downloading it to your local desktop, but had I done that, I wouldn’t be able to commit or check anything in unless I had contribute/collaboration rights, which I do not. I do, however, have rights to my own GitHub (imagine that!), so having a fork of that code allows me to check it out of my repository and make and track and changes to it by committing it to my own GitHub.
After making my changes, I saw that they could actually be beneficial to others that are actively using the library that I forked my code from. At that point, I issue a pull request to the original owner of the GitHub repo. It is up to him to review my request and either accept it, which will merge my code with his, or reject it. If he would have rejected it, it would have still been present in my GitHub repo, which I am free to promote and publicize.
But I work in Visual Studio…
The good news is that as totes adorbs as as the GitHub client for Windows & Mac is, you don’t have to give up the convenience of checking code in and out of source control directly from Visual Studio. Since Visual Studio 2012 Update 2, Git has become available as an integrated source control provider (see Scott Hanselman’s post on setting it up).
As I mentioned, I joined in June of 2012, but didn’t have my first true commit of non-poking-around nature since months after that. In addition to the code and contributions, I also use it for hosting snippets that I reference in my blog, as well as an archive repository for my old blog – maxslabyak.github.io. That’s right – you can host web pages, even complete sites (fairly static though) by checking out the easy-to-follow guide here – http://pages.github.com/.
Git & Github may not be for everyone, but Github is free if you are hosting public repositories. I say it doesn’t hurt to download and poke around. Some say it’s even becoming the new résumé for coders. While I doubt that it replaces the traditional CV, you can be certain that the newer code shops may ask you, if not require you to at least be familiar with Git.
The minion github logo at the head of the document was originally submitted as an Octocat to Octodex.GitHub.com by Nick H – http://octodex.github.com/minion/.