is this behaviour expected for "git clone --single-branch"?

From: Ralf Thielow <hidden>
Date: 2016-06-15 22:54:44

Hi,

I know people which have a separate directory for every
branch. In this case it doesn't make sense to download
the whole repo with all branches. So I guess the
"--single-branch" option is the solution in that case!?!
But I'm wondering about it's behaviour.

# first clone the branch of the repo
$git clone --single-branch --branch master myrepo ./master
$cd master

# now calling "git branch -a" to see what I have
$git branch -a
*master
remotes/origin/HEAD -> origin/master
remotes/origin/master

# fine, now pulling from origin
$git pull
From myrepo
* [new branch]  foo  -> origin/foo
* [new branch] bar -> origin/bar
...

Hm?

# looking again to my branches
$git branch -a
*master
remotes/origin/HEAD -> origin/master
remotes/origin/master
remotes/origin/bar
remotes/origin/foo
...

After cloning (or fetching), I now have all branches which is not
what I want, because I'm only interested in the one I've cloned.
I think it's not very useful for the use-case of having one directory
for one branch.

$git version
git version 1.7.12.395.g6b149ce

Thanks
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help