Q:

Checkout branch from Github without cloning whole repo, and without Git

I'm often building servers where the goal is to install some software that is stored in Github. The process goes:

Install Git.
Clone the Github repo.
Checkout the right branch.

Steps 1 and 2 can be pretty slow (a few minutes). Are there any tools that would allow me to cut to the chase, step 3? I'm thinking something like:

Get gitcheckout tool (bash script)
It directly pulls down the relevant files from the right branch in Github.

A:

If you want to use git and if your git is new enough to have --single-branch:
git clone --single-branch --branch=<branch> --depth=1

Otherwise, you can download the source in a zip:
wget https://github.com/<user>/<project>/archive/<branch>.zip

