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.

1 Answer 1

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.

Sign up to request clarification or add additional context in comments.

3 Comments

Hm...I don't see the "download zip" option -- github.com/Theano/Theano/commit/…
Change your URL from commit/ to tree/. It's a button located on the lower left column, after 'Clone in Desktop'.
Ahhh, I see it now, for some reason the URL on my case was github.com/Theano/Theano/tree/<commit sha>, not github.com/Theano/tree/<commit sha> (github.com/Theano/Theano/tree/…)

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.