11. GitHub

There are currently several hosting sites that offer free git hosting for open source projects. By far the best known of all is Github.⁠[138] Two other well-known pure git hosters are Gitorious[139] and repo.or.cz.⁠[140] But also already established hosting sites like Sourceforge[141] and Berlios[142] now offer Git hosting.

Github was founded in 2008 by Chris Wanstrath, P.J. Hyett and Tom Preston-Werner. The platform developed in Ruby on Rails has over three million users and hosts over ten million repositories. Even if you consider that many of these repositories are so-called Forks (clones) of other repositories or so-called Gists (source code snippets), this is still a considerable number. Many well-known projects use Github nowadays to manage their source code, among others the command line tool Curl,⁠[143] the web framework Ruby on Rails[144] and the JavaScript library jQuery.⁠[145]

The free offer includes unlimited Git repositories — with the restriction that these are publicly available (public repositories). In addition, Github offers paid options for individuals and companies to create and use restricted access repositories (private repositories). For large companies, Github offers a solution called GitHub Enterprise.

GitHub offers all the essential features you expect from a project hosting platform, including project wikis and issue trackers. But the special thing about it is that the wiki system Gollum[146] does not use a database as backend, but only a Git repository. As markup, Github offers several syntax options,⁠[147] including Markdown, Textile, Mediawiki and AsciiDoc.

The issue tracker is designed for Git and also lists pull requests created via the web interface. Additionally, an email backend has been integrated into the issue tracker. Your responses to the incoming emails are automatically processed by GitHub and also displayed in the web interface. But what GitHub does not offer are mailing lists — for that you have to use alternatives.

github gollum
Figure 58. GitHub page from Gollum

Figure 58, “GitHub page from Gollum” shows a section of the Gollum project page. Important are the menu items Source (source code overview), Commits, Network (forums of the project with changes), Pull-Requests, Issues, Wiki and Graphs (statistical graphs). Other important controls are the button Fork as well as Downloads and also the display of the clone URL.

With GitHub, the developer is the focus of attention: repositories are always assigned to users. This is a big difference to established hosting platforms, where projects are always the main focus and users are subordinate to them. (However, it is also possible to create project accounts in GitHub, to which users are then assigned in turn — popular with private repositories and larger projects).

GitHub offers many ways to share changes. While it is possible to take a centralized approach with GitHub (see Figure 30, “Central workflow with distributed version management”) by giving others access to your own repositories, the most common form of sharing is an Integration Manager workflow (see Figure 37, “Integration Manager Workflow”).

github workflow
Figure 59. Workflow at GitHub
  1. A potential contributor forks[148] a repository at GitHub.

  2. The public repository is then cloned and changes are made.

  3. Commits are uploaded to the public repository.

  4. A pull request is sent to the project author. As already mentioned, these can be created and sent directly in the web interface.

  5. The author loads the changes from the public repository, checks whether they meet his quality standards and integrates them locally via merge or cherry pick if necessary.

  6. The contributor’s changes are uploaded to the author’s public repository and thus merged with the software.

  7. The contributor synchronizes his local repository with the author’s public repository.

The GitHub web interface offers a lot of Web 2.0 comfort. For example, instead of steps 5. and 6. you can merge directly via the web interface with a single click. Of course the system checks if the merge can be done without conflicts — if not, a warning will appear instead of the merge option.

Since recently it is also possible to perform steps 1, 2, 3 and 4 completely in the web interface. To do this, click on the button Fork and edit this file in a foreign repository — the repository will be automatically forked for your user account, and a web-based editor will open, where you can enter your changes and a commit message. You will then be automatically redirected to the pull-request page.

Since you can quickly lose track of many forks, GitHub provides a graphical representation of the forks with pending changes, the so-called network graph:

github network
Figure 60. The GitHub Network-Graph

Github offers even more visualizations under Graphs. Under Languages you can see which programming languages the project uses. The Impact graph shows which developer has done when and how much. Punchcard shows the commit activity for weekdays and times of day. Traffic finally lists the number of project page views during the last three months.

As the slogan Social Coding suggests, GitHub has several features that you can also find in social networks. For example, you can follow both individual users and repositories. You will then receive a kind of GitHub news ticker in your dashboard: messages about new and closed pull requests, new commits that have been uploaded, forks, etc. The news feeds of the users and repositories are also available as RSS feeds, if you prefer external newsreaders.

A small, still relatively unknown project can therefore become known very quickly via GitHub when a critical number of “followers” is reached.

GitHub also offers a pastebin service, the Gist. However, unlike other Pastebin services, GiThub’s gist is a full-fledged Git repository. Especially for code snippets this is an interesting innovation.

GitHub also does a good job when connecting to external services. There are 50 so-called service hooks that you can use to forward messages concerning a repository to external services. Among them are old classics like e-mail and IRC, but also more modern alternatives like Twitter and Jabber.

But GitHub also offers additional “gimmicks” that are very handy. So tags automatically become source code archives for download. As you can see in Figure 61, “Downloads created from tags”, both as .tar.gz and .zip archives.

github download
Figure 61. Downloads created from tags

For developers who often work with images, GitHub offers so-called Image View Modes.⁠[149] They show differences between two versions of an image, similar to the script introduced in Sec. 8.1.3, “Own Diff Programs”. There are the following modes:


The two different versions are displayed side by side, see Figure 62, “The 2-up image mode”. Differences in size are also visible.

github image diff 2up
Figure 62. The 2-up image mode

The image is split in the middle. On the left you see the old version and on the right the new one. Move the slider back and forth to see the changes. See Figure 63, “The swipe image mode”.

github image diff swipe
Figure 63. The swipe image mode
Onion Skin

A slider is also used here, but this time the new version is faded in, so there is a smooth transition between old and new.


Displays only the pixels that have been modified.

The programmers behind GitHub continue to refine the web interface and so innovative improvements are added regularly. The site has its own help page,⁠[150] where steps with the webinterface are explained in detail with screenshots.

138. https://github.com
139. https://web.archive.org/web/20150303192558/http://gitorious.org
140. https://repo.or.cz
141. https://sourceforge.net
142. https://www.berlios.de
143. https://curl.se
144. https://rubyonrails.org
145. https://jquery.com
146. https://github.com/gollum/gollum
147. https://github.com/github/markup
148. Not to be misunderstood as a project fork, where a project splits due to internal differences.
149. https://github.com/blog/817-behold-image-view-modes
150. https://help.github.com