Git Basics

This post is part of a series designed to help developers who are just starting out understand some basics and how they relate to WordPress. This eight post in the series is about Git, which unlike previous posts, doesn’t stand for anything and is neither an acronym, initialism, or abbreviation. We’ll walk you through the basics and provide a video on how to get started hands-on.

Okay, so what is Git and how does it relate to GitHub? First let’s tackle what Git is and then we’ll explain how it relates to GitHub. Git was created in 2005 by the same guy who created the Linux OS, Linus Torvalds. He said that he names all of his projects after himself, and thus he came up with the term “git” which is slang in British English for an unpleasant person. So the name was an inside joke of sorts that not many people get.

Git is a distributed revision control and source code management system. What that means in plain English is that it allows multiple developers to work on the same project without stepping on each others toes and overwriting their changes. Think of it as a tracking system in a sense that allows a nice view of who did what and when. It is now the most widely adopted version control system on the planet for software development. It is a free open source download that you can find here.

Every working directory in Git is a repository with complete history and version tracking capabilities. You can find out more about what a working directory is here, and what a repository is here. Adding explanation for each of those would require a separate article in itself. However, you can view the above links and get a pretty good idea by skimming them.

So how does Git differ from the other popular software versioning and control system SVN? Apache Subversion (SVN) repositories are similar to Git repositories but there are several major differences. They use different directory structures, name and handle subprojects (a project outside of the main project) different, and finally preserve history in different fashions. You can read a detailed analyses and comparisons here and here.

So let’s say you’ve chosen to use Git and want to use GitHub because you’ve heard it’s amazing. What is GitHub? Well it’s a SaaS offering where you can store your repositories (repos for short). Hence the name GitHub, as it’s basically just a hub for repositories. Much like you might use Google Docs, Basecamp, or Dropbox to collaborate on spreadsheets or presentations, you can use GitHub to collaborate on software you’re building with your other team members. I remember programming in BASIC in junior high many years ago and people would always be overwriting their team members code. GitHub helps prevent that sort of thing from happening.

So the idea is that everyone on the team is making commits/snapshots after each incremental piece of code, so that team members might make 4-12 commits per day (depending on how much code they’re writing) and everyone can review/comment on them as they happen and more importantly prevent disasters from happening. For more information you can check out the official Git site, and watch the below official Git videos to learn more and get started. Also you can check out GitHub pricing, download the client for Mac or Windows, and signup for one of GitHub’s excellent training courses.

0 Comments