Cloning an older version of github repo

Also for Github.com UI,

For those wanting to download a specific Commit, steps are below:

  1. Go to "Commits"
  2. Click the "<>" icon to the right of the desired commit
  3. Select Clone or Download
  4. Download ZIP

Commits

Select Commit

Download ZIP


Git is not designed that way. When you clone a repository, you are copying all versions.

So first clone a repository (which does initially checkout the latest version), then checkout the version you actually want.

You can checkout the commit based on the hash.

git checkout afe52

You can also checkout based on date (instead of looking up the hash), eg:

git checkout 'master@{1979-02-26 18:30:00}'
git checkout @{14.days.ago}

To check the commits you can checkout, use git log.


You can always check out any given state by using a commit hash.

For instance, by looking at the log, you identified that 233ab4ef was the state you were interested in: issue a git checkout 233ab4ef to check out that state.

Another way to achieve this is by using git checkout @{14.days.ago}