Understanding git
Have you ever played Braid? That time travel game Jonathan Blow made back in like 2008? Well, probably not, but go watch the video and then you’ll know exactly what git
is. Kind of! Somewhat!
git
, a version control system
git
, at its simplest, is a version control system, which means its a way for programmers to keep really fancy backups.
A Game of Thrones, using git
Since nothing is more annoying than software analogies and I’m being paid to make you miserable, let’s say George R.R. Martin were writing A Game of Thrones and keeping track of it using git
.
Repositories
First, GRRM would make a thing called a repository. A repository is where all of his words will go, and all of his updates, and all of his files, and anything else associated with the project. It would probably be in a folder called a-game-of-thrones
, because that would make sense.
Commits
Every time GRRM made a change to his book - when he added a chapter, or edited a paragraph or whatever - he could make make a checkpoint. This is a point he could go back to at any time in the future. Did Joffrey turn into a dragon? Did someone’s sword accidentally invent television? GRRM could go back and check exactly when he put such a dumb thing into the books. In git
this sort of checkpoint is called a commit.
GitHub
But, god forbid, what would happen if GRRM’s computer crashed? Would all of the Game of Thrones books be destroyed? People would be pretty angry, and he might even get a mean letter or two. Luckily git
can protect against that! One of the major benefits of git
is that you can plug into online services to keep copies of your repositories. One of the most popular services for hosting repositories is GitHub.
GitHub is kind of like Facebook for programmers - there’s lot of communication and sharing going on.
Forking
GitHub can do more than host code and allow you to leave angry comments, though! If you didn’t like that Jon Snow ate a turkey in one chapter - there are no turkeys in Westeros! - and instead really wanted to have him eat a chicken, you could actually make a copy of the Game of Thrones repository and make your own edits. This is called a fork. You’d then have your very own version of the repository that you could make your very own commits on.
Pull Requests
Beyond that, if you were exceptionally sassy, you could send your edits back to GRRM and demand that he incorporate them. This is called a pull request and is a great way to contribute to software projects.
Open Source
This whole system of having a book - or code! - freely available for reading, forking and personalizing is called open source (depending on who you ask).
And so that, my friends, is git
in a nutshell. Once you’re set up and go through an example you’ll get a better idea of how it all works.