
1 owt5008137 2016-08-13 15:25:12 +08:00 via Android git clone -b hakyll https://github.com/agbell/agbell.github.io |
2 luckypoem OP @owt5008137 ,谢谢你 |
3 snnn 2016-08-13 17:18:22 +08:00 BTW ,不管你怎么 clone, 下载下来的都是所有 branch 。 |
4 luckypoem OP 标题写错了。应是:怎么克隆非 master 的源码? |
5 Hanxv 2016-08-13 19:58:25 +08:00 via Android 你本地切换分支啊 |
6 fatedier 2016-08-13 20:09:08 +08:00 先把项目直接 clone 下来,之后切换到那个分支, git checkout -b hakyll origin:hakyll |
7 smallpath 2016-08-13 20:18:22 +08:00 懒癌的话, 可以先 clone master 分支, 再在本地新建想要拉取的分支, 最后 pull 新建的分支 |
8 shimanooo 2016-08-13 20:25:21 +08:00 clone 之后,远程分支在本地会变成 origin/xxx 这样。 然后 git 自动建立 master 分支,跟踪 origin/master 。 |
9 zhaoace 2016-08-14 14:07:21 +08:00 我来帮忙解释一下发生了什么吧。 https://github.com/agbell/agbell.github.io/tree/hakyll 这个 link 里面 1.「 https://github.com/agbell/agbell.github.io 」这个部分是 repo 的实际地址 2. tree 代表是是个 folder ,如果是实际代码一般是 blob 表示是二进制文件。 比如 「 https://github.com/agbell/agbell.github.io/blob/master/about.html 」 3. hakyll 是这个库的分支。 所以你直接 clone 整个完整 url 是不行的。 @owt5008137 是帮你 clone 了这个 repo 然后切换到了对应分支。 「 git clone -b hakyll https://github.com/agbell/agbell.github.io 」 你也可以分两步走: 1. clone 整个库: git clone https://github.com/agbell/agbell.github.io 2. 切换到对应分支 git check out hakyll 另外如果你只想要代码,不想在 git 上花时间的话你可以 直接 download , 这样就直接 download 该 url 对应的分支的代码啦。 |
10 adoyle 2016-08-15 09:10:33 +08:00 git clone 有 --single-branch 选项。可以不用下载所有分支。 |
11 ilotuo 2016-08-15 09:28:37 +08:00 via Android git checkout origin/xxxx git checkout myxxx git commit |