Friday, 6 May 2016

Guide to GitHub

Guide to GitHub

David Briddock explains how to take advantage of this cloud-based development repository

GitHub was created to act as a cloud-based development source code repository for individuals, established companies and startups. Despite appearing only six years ago, today GitHub ( is an essential resource for the open source community.

Did you know its appeal extends far beyond software development, though? In fact you can store any kind of textual document, spreadsheets, presentations, images and other media files using it’s resources. For example, visit the Raspberry Pi Foundation’s GitHub repository ( and you’ll find a wide assortment of files including firmware, Linux and NOOBS software, the complete HAT specification and a full set of official documentation.

In this guide we’ll explain why GitHub is so popular, highlight some of its key features, then show how to get involved by creating your own GitHub repository.


Git was created by Linux kernel developers to manage their own source code files (see boxout). However, while Git is still a very popular tool in the Linux community, the command-line interface tends to restrict its widespread adoption. It’s this deficiency that led to the creation of the GitHub project.

The GitHub website is essentially an easy-to-use front-end to Git. Conceived by Tom Preston-Werner, Chris Wanstrath and PJ Hyett in late 2007, after a short beta-testing period, this team launched the website in April 2008. GitHub delivers core Git functionality through a simplified graphical user interface, or GUI, and being browser-based means it supports any desktop or laptop PC, plus many tablets and smartphones. So every project, large or small, can use the same set of powerful tools to help push it towards completion.

Today GitHub is the largest code hosting environment on the planet, with over 31 million repositories, which are accessed by around 12 million users. It offers both free public-access accounts and paid-for private-access repositories.

Key Features

GitHub delivers two key pieces of Git functionality that aid collaboration between teams of coders, they are known as source code management and distributed revision control.

The former is sometimes referred to as ‘version control’ or ‘revision control’, and works to track each and every change that’s made to source code, configuration files, documentation and other similar textual documents. These changes could be as small as a single character or extend to the complete replacement of the text. Each block of changes corresponds to a specific version of the code or document file. And this means it’s possible to travel back in time and retrieve a specific version, something that’s immensely useful when trying to track down software bugs.

Source management is of critical importance when files are authored and edited by a team of people. This type of interaction is generally called ‘distributed revision control’ or ‘decentralised version control’. In practice it means the various files have a distributed collection of working copies that are shared between a group.

Additional collaborative GitHub features include granting read/read-write/admin-level file access, bug tracking utilities, task management tools and project-specific wikis. Also, its social networking integration helps team members keep tabs on project status and easily follow activity feeds.

Browse And Download

Anyone can browse a public GitHub repository, all you need is a browser. Most have a sizeable collection of files. In fact, the majority of repositories have numerous named folders, each of which can contain more files and sometimes a number of subfolders.

Exploring a repository is a great way to discover what it takes to create an app, plugin, utility or game. You’ll probably be surprised at how many files are involved. Along the way you’ll learn quite a bit about software development and pick up some coding tips and tricks.

A typical software project has code files written in more than one programming language. For example, a web browser plugin invariably has numerous HTML, CSS and JavaScript files, which are often supplemented by plain text, XML configuration and image files.

If you find something of interest, say a cool piece of code or a handy app, there’s a couple of things you can do. If it is a text file you can simply copy the content, either everything or just specific sections, and paste it into your own file.

This copy and paste approach is fine if you’re cherry-picking bits and pieces. However, if there are a few things that spark your interest it’s better to download the complete repository using the button on it’s home page. This will download a zip file to your PC containing all the repository’s files, folders and sub-folders.

Sign Up

Free and open access to all these GitHub goodies might be all you’re after. However, if you’d like to create a repository and upload your own content you’ll need to go online and sign up for a GitHub account. It’s a pretty simple and quick process: provide is a username, email address and password and you’re free to create and manage your repositories. Though remember, by default anything you store in your repositories is publicly available.

You can create as many repositories as you like. However, as your repository collection grows, it’s important to give each one a meaningful name. These names also help others when searching for specific GitHub content.

As a signed up user you’re also able to contribute to repositories set up by other people or organisations, by submitting new content or modifications (more on this later).

Apps And Plugins

Once you’ve created a repository or two on the GitHub website you’re free to add, update and remove files. However, this is invariably a rather tedious process using only the browser. So the best plan is to do all the editing on your PC.

The simplest way to manage your repository files on a PC is to download a Git app or plugin. They make it much easier to synchronise your additions and changes with the online GitHub repository. Apps are available for all the popular platforms including Windows, Mac OS X and all flavours of Linux. These apps offer an easy-to-use Graphical User Interface (GUI), so you don’t have to learn a collection of Git commands to create repositories, upload new files and update existing files.

GitHub plugins are all about integrating Git functionality into an existing development workflow. This means you’ll likely download and apply a plugin for your favourite editor or Integrated Development Environment (IDE). Popular examples include the Eclipse IDE ( and editors like Sublime (

For fans of the good-looking Atom editor (which incidentally includes myself) it’s even easier as this editor has built-in Git support, including colour-coded flags in the file tree, code gutter and status bar (

Simply download and install your chosen app or plugin, fire it up, sign in to GitHub and you are good to go.

Clone To PC

Once you have an app or plugin you’re next step is to get the repository files. There’s a dedicated ‘Clone’ button on the repository home page. It’s located next to the ‘Download Zip’ button and has an icon that looks like a desktop with a downward facing arrow.

Simply click this button to initiate a digital transfer between the GitHub website and your PC. It won’t be too long before you’ll see the chosen repository appear in your GitHub app’s window or development tool. Now you can simply edit the files with your favourite tools, before synchronising any changes.

Here’s a useful tip. When committing your changes make sure you provide meaningful comments. Informative comments ensure the change history log is an accurate record of what actually happened. It’s especially important when working in a team environment.

Collaborative Coding

At some point you might decide to contribute to a GitHub project owned by someone else. For instance to perform a documentation update or add some new functionality to a web browser plugin or enhance a Minecraft mod. The starting point is to create a new branch.

A branch is essentially a duplication snapshot of the current repository. With this branch you can experiment all you like, adding new code and even breaking things, without impacting anyone else. All branches have names. In fact when you create a repository something called the ‘master’ branch is automatically created for you.

To create a new branch in GitHub you’ll need to perform a fork operation. There’s a dedicated ‘fork’ button on each repository home page. Once clicked you’ll need to select a destination repository to complete the operation. This may be a repository you already own or one where you’ve been assigned write access.

GitHub also has a social network graph capability that helps to visualise a repository’s fork and branch activity over time. So you can also see what other people are working on.

Once you’ve finished making your changes and completed any relevant testing it’s time to submit them back to the original repository. However, it’s always up to the repository owner to decide whether any of these changes will be accepted. This collaborative change review process is an essential part of the GitHub workflow.

Pull Requests

So how do you submit your changes? With GitHub, it starts with something called a Pull Request; once again there’s a dedicated button on the repository home page, although this time it will be the repository hosting your forked branch. A key aspect of Pull Requests is that they contain information about the changes made and the reasons behind each change. If you click the change log link, it will display all the changes (additions, updates and deletions) made on a specific file. They are shown as coloured-coded highlight lines. Open the commit tab to enter your change comments.

A Pull Request instigates a ‘live conversation’ that streamlines the process of discussing, reviewing and managing repository changes. This conversation allows all interested parties to evaluate the proposed modifications. It’s a key step as it allows everyone to have their say on the changes as a whole, certain sections or even one specific line.

Once accepted, a Pull Request can be ‘merged’ back into the original repository. This is typically done on the ‘master’ branch. However, in some circumstances it may be better to merge it into another branch first, say to allow further testing on a suite of proposed changes from multiple developers before final acceptance is given.

Going Private

GitHub is completely free to use for public projects. So anyone can create a repository and its contents will be shared with the world.

However, in some cases organisations or individuals want to have the ability to restrict access. This is achieved with a paid-for private GitHub repository, which operates in a similar way to a public repository and uses the same tool set.

Costs vary depending on the number of private repositories required. For an individual who only needs five private repositories the cost is a reasonable $7 a month, while those working on bigger projects who need 50 private repositories will have to shell out $50 a month.

Organisational level plans are aimed a business teams and offer permission level configuration support. They start at the $25 a month Bronze level with 10 private repositories, then go through Silver, Gold and Platinum up to the $450 a month Diamond option with 300 private repositories.

There are also a number of Enterprise level licences to choose between, should they suit your needs. They start, however, at $2,500 a year – but include maintenance, upgrades and support.

Learning Git

Exploring what’s possible with Git can be a little daunting at first. Git has an extensive list of commands to learn and becoming proficient demands plenty of hands-on experimentation. Fortunately help is at hand. One of the most useful resources is GitHub’s Git Cheat Sheet (, which includes all the most commonly used commands.

Git newbies might like to try the online Try Git experience, which is designed to teach you the basics in just 15 minutes ( This website presents an interactive set of Git command lessons based on an imaginary GitHub repository.

If you’re after a comprehensive reference, one that covers every aspect of Git in detail, then download the open source ProGit book ( Written by Scott Chacon it’s available in PDF, EPUB, MOBI and HTML formats.

And finally GitHub has its own collection of help pages at plus an official YouTube channel with stories and useful tips (

GitHub Repositories

Here’s just a few public repositories for you to check out while you get to finding your way around:

Raspberry Pi:
Google Chrome:
Oculus VR:
BBC News:
The Guardian:
The White House: