我现在已经在这上面打了一个小时了。我做了一个简单的结账:git clone https://github.com/[repo name] -b [branch name] T
然后当我看到T时,我看不到正确的分支!我看到头或类似的东西。当我进入T时,我做git log
,我看到了我期望的签到。当我git diff
带有旧版本的头部时,我看到了我期望的变化。我验证了git remote show origin
- 一切看起来都不错。
为什么T中的文件不对应相应的分支?
~/src: git clone https://github.com/nouiz/Theano.git T
Cloning into 'T'...
remote: Counting objects: 141244, done.
remote: Compressing objects: 100% (48/48), done.
remote: Total 141244 (delta 27), reused 0 (delta 0), pack-reused 141196
Receiving objects: 100% (141244/141244), 54.72 MiB | 1.91 MiB/s, done.
Resolving deltas: 100% (112338/112338), done.
Checking connectivity... done.
~/src: cd T
~/src/T: git checkout NeilGirdhar-master
Branch NeilGirdhar-master set up to track remote branch NeilGirdhar-master from origin.
Switched to a new branch 'NeilGirdhar-master'
现在,检查theano/tensor/subtensor.py
与latest commit不匹配。
答案 0 :(得分:1)
这里的文档令人困惑。我认为git clone https://... -b [branch name]
会让你处于一种超然的状态。
您通常不会克隆单个分支。我想你会达到你期望的结果:
git clone https://...
git checkout branchname
详细了解可用的克隆选项here。
答案 1 :(得分:1)
如果您想将克隆限制为一个分支:
--[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.
答案 2 :(得分:1)
我重复了您的示例(克隆https://github.com/nouiz/Theano.git
)并查看了指向commit b8c6186f8a164bee377fc4efbe589bf27773201a的链接。 diff(针对该提交的父级)显示对:
theano/tensor/tests/test_subtensor.py
但是,我会注意到,不是:
theano/tensor/subtensor.py
通过名称检查相同的分支会得到相同的提交,tests/test_subtensor.py
文件具有github网页上diff所隐含的内容。
这只是一个剪切和粘贴错误文件名的情况吗?