Neil G Neil G - 4 months ago 12
Git Question

Why after cloning a single branch in git, does the directory not match?

I have been banging my head on this for an hour now. I did a simple checkout:

git clone https://github.com/[repo name] -b [branch name] T


Then when I look in T, I don't see the right branch! I see the head or something like that. When I go into T, I do
git log
, and I see the checkins I expect. When I
git diff
the head with an old revision, I see the changes I expect. I verified
git remote show origin
— everything looks good.

Why do the files in T not correspond to the appropriate branch?




~/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'


Now, examining
theano/tensor/subtensor.py
does not match the latest commit.

Answer

I repeated your example (cloning https://github.com/nouiz/Theano.git) and looked at your link to commit b8c6186f8a164bee377fc4efbe589bf27773201a. The diff (against the parent of that commit) shows changes to:

theano/tensor/tests/test_subtensor.py

but, I will note, not to:

theano/tensor/subtensor.py

Checking out that same branch by name gets me that same commit, and the tests/test_subtensor.py file has the contents implied by the diff on the github web page.

Is this just a case of cut-and-paste-o wrong file name?