Getting a particular version of a branch

最后都变了- 提交于 2019-12-06 07:36:47

问题


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:


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.



来源:https://stackoverflow.com/questions/26091467/getting-a-particular-version-of-a-branch

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!