Dark theme

Pulling from GitHub


So, we've seen how we can get our own code onto GitHub. What about downloading others'?.


You can set up organisations on GitHub, for groups of programmers (help). If someone adds you to one of these, you'll see the organisation and their repos listed, and you can clone them as before.

Screenshot: clone option


To download code from another repo you don't belong to, log into the GitHub website and navigate to the repo. Push the "Clone or download" menu (see picture).

Press Open in Desktop and allow the site to open GitHub Desktop. It will then look like a standard clone process. You must be logged in to do this, or it will just point you at the download for GitHub Desktop.

Screenshot: clone web

 

People not logged into GitHub can still download code as a zip file.

Screenshot: clone web

If you want to try cloning, you can find some code to clone at:

https://github.com/AJEvans
https://github.com/MassAtLeeds


The final thing you can do is "Fork" a repository. This involves taking an entire copy of another repository and moving it to your development space. Traditionally the reason for doing this was if you want to build an entirely new piece of software using someone else's code as the starting point; the advantage over cloning is that there is a recorded link with the old project such that it is clear that the old project acted as a foundation, and everyone can see which versions were forked from which. Project owners generally encourage forking over cloning, so they can keep track of/evidence the excitment around their code.

Screenshot: fork map of nickmalleson's repastcity
Fork Network for Nick Malleson's RepastCity.

However, more recently forking has become a common way to invite changes to a project – people can fork a project, alter it, and then make a "pull request" to the project to get their changes merged in. This is common in projects where lots of groups that don't really know each other are working on software – it has subtle connotations of "ok, let's see what you come up with, but no guarentees your changes are going back into the original", whereas adding collaborators is much more "whatever you do, it'll make it in unless everyone can be bothered to undo it".

To "fork a repo", click on the "Fork" button at the top right of any project on the GitHub webpages, and it will ask you where to copy it (if you belong to organisations etc.). Forking is done through the website, as this is where all the projects know about each other. You can find out more about issuing a pull request for a fork at GitHub's help pages. Note that pull requests are also used to merge branches within a single project. More on pull requests and forks here.


Have an experiment with the interface and the website. You can't do any real damage as long as you're working on your own repos and not pushing code to someone else's.


In the next part we'll look at resolving conflicts.