2016-08-03 88 views
1

我一直在這裏砸了我一個小時。我做了一個簡單的結帳:git clone https://github.com/[repo name] -b [branch name] T爲什麼在克隆git中的一個分支之後,目錄不匹配?

然後當我看着T,我沒有看到正確的分支!我看到頭像或類似的東西。當我進入T時,我做了git log,我看到了我期望的簽入。當我修改舊版本時,我看到了我期望的變化。我驗證了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

回答

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所隱含的內容。

這只是一個剪切粘貼錯誤的文件名?

+0

是的!哎呀!你說對了。 –

1

這裏的文檔令人困惑。我認爲git clone https://... -b [branch name]會讓你處於一種獨立的狀態。

您通常不會克隆單個分支。我想你會實現你期望這樣的結果:

git clone https://... 
git checkout branchname 

瞭解更多關於可用here克隆選項。

+0

感謝您的回答,但它仍然不適合我。你是對的,這檢查了正確的分支,但即使我'git日誌',它顯示了一堆提交,這些提交似乎並沒有被應用。有沒有一種方法可以確保我已經應用了所有這些方法? –

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. 
+0

謝謝,但我試過 - 單一布拉奇,它沒有改變任何東西。 –

+0

對不起,奇怪的是,導致組合 - 單支和 - 分支限制了我的克隆只有一個分支被指定爲克隆回購中的活動分支並且歷史限於該分支。 – DavidN

+0

你是對的,這是有效的,但由於某些原因,即使歷史記錄在'git log'中,它似乎並不適用於該文件夾中的文件。 –