下载 github 项目的特定分支

Download a specific branch of a github project

简而言之,为了运行一个卷积神经网络模型,我需要一个特殊版本的nolearn,它有一个url形式https://github.com/dnouri/nolearn/tree/1659e4811e498dc1f442d8e6486d0831f85255b4/nolearn 。但是页面上没有Download as Zip按钮,我也无法用

下载
git clone https://github.com/dnouri/nolearn -branch 1659e4811e498dc1f442d8e6486d0831f85255b4/nolearn

简单地说,

git clone https://github.com/dnouri/nolearn/tree/1659e4811e498dc1f442d8e6486d0831f85255b4/nolearn

也不行。

甚至,我不知道我应该在 Google!

中搜索什么

注意:这是支持 class Objective 的最后一个版本,即不再支持命令 from lasagne.objectives import Objective

这是 .zip 的 link:https://github.com/dnouri/nolearn/archive/1659e4811e498dc1f442d8e6486d0831f85255b4.zip

这可以帮助你:

How to clone a single branch in git?

指定的地方:

git clone <url> --branch <branch> --single-branch [<folder>]

文档 :

Git Clone

--[no-]single-branch

Clone only the history leading to the tip of a single branch, either specified by the --branch option or the primary branch remote’s HEAD points at. When creating a shallow clone with the --depth option, this is the default, unless --no-single-branch is given to fetch the histories near the tips of all branches. Further fetches into the resulting repository will only update the remote-tracking branch for the branch this option was used for the initial cloning. If the HEAD at the remote did not point at any branch when --single-branch clone was made, no remote-tracking branch is created.

与 Subversion (SVN) 不同,git 对目录(文件系统文件夹)、分支和标签有单独的命名空间。因此 https://github.com/dnouri/nolearn/tree/1659e4811e498dc1f442d8e6486d0831f85255b4/nolearn 本身不是一个分支。 1659e4811e498dc1f442d8e6486d0831f85255b4 是一个commit ID,这里用来指commit创建的revision。 dnouri/nolearn 是 GitHub 上的存储库名称(帐户 dnouri 上的存储库 nolearn),URL 中的最后一个 nolearn 是修订内容 1659e4811e498dc1f442d8e6486d0831f85255b4.

使用 git 获取此代码的 'normal' 方法是:

  1. 将存储库复制到您的本地计算机

    git clone https://github.com/dnouri/nolearn.git
    

    (您可以在存储库页面 https://github.com/dnouri/nolearn 的 'clone URL' 字段中找到此 URL。)

  2. 进入本地仓库

    cd nolearn
    
  3. 查看想要的修订版

    git checkout 1659e4811e498dc1f442d8e6486d0831f85255b4
    
  4. 切换到存储库中的相应目录

    cd nolearn