4

Is there a way to download a particular version of a branch?

In particular I'd like to do a git clone of https://github.com/Theano/Theano now, and save a set of instructions on how to get the exact same version from github, regardless of future commits.

Yaroslav Bulatov
  • 57,332
  • 22
  • 139
  • 197

1 Answers1

3

UPDATE

There is an easier way to do this on github if no further changes are expected. In github, you can navigate to the 'tree view' of a repository from your browser via the URL

https://github.com/<repo_name>/tree/<commit_sha>

Clicking on the 'Download ZIP' button on the right-hand navigation bar will download the codes of the repository up to that particular commit.

ORIGINAL ANSWER

I think one way to make your user's (or whoever will be reading your instructions) life easier is to clone the entire repository as-is. Then if the current HEAD commit is the version you want and you don't plan on making/merging changes to your repository, you can just refer your user to this new repository; probably tagging it will be a good idea.

Otherwise, you can create a branch (and a tag) in your new repository with the specific commit by doing:

$ git checkout -b new_branch commit_sha // where commit_sha points to the version you wanted

Then you can refer your user to this new branch (or tag) in your repository, after they have cloned your repository.

I don't think there is a simple way to clone the original repository from an old commit without using git reset.

ivan.sim
  • 8,972
  • 8
  • 47
  • 63
  • Hm...I don't see the "download zip" option -- https://github.com/Theano/Theano/commit/0e8f48e58e42d7c56dc027df921b7877d4d68d78 – Yaroslav Bulatov Oct 01 '14 at 05:43
  • Change your URL from *commit/* to *tree/*. It's a button located on the lower left column, after 'Clone in Desktop'. – ivan.sim Oct 01 '14 at 05:44
  • Ahhh, I see it now, for some reason the URL on my case was https://github.com/Theano/Theano/tree/, not https://github.com/Theano/tree/ (https://github.com/Theano/Theano/tree/0e8f48e58e42d7c56dc027df921b7877d4d68d78) – Yaroslav Bulatov Oct 01 '14 at 05:45