A friend is stuck with an old version of Git (I think he said 1.5?), where he says the -b <branch> option is not supported. I can’t wrap my head around it, so I really hope someone could help:
What would be the equivalent of the following command, without using -b?
git clone -b $BRANCH $REPO
EDIT: I originally asked for git checkout – that’s not what I meant. Sorry!
in older git this required two steps:
notice i used
$FROM_COMMIT,$REPOin your question looks odd and misleading – you can only create branches from commits, not from other repositories.editing my answer, since the question was altered. reading the manpage for git clone, we can see that
to achieve this effect with an older git version we would use:
this will set your local
HEADto the newly created$BRANCHwhich is pointing toorigin/$BRANCH(hopefully i’m not mistaken – i don’t have a git install here to test …)