I can list the branches on my remote repository like this
git ls-remote https://blah.visualstudio.com/Blah/_git/Software
which gives me the list of branches available on the remote:
e7dcd105d5a03d0dc176f9e29fae020c0419c4fb HEAD
500fde10ba1498fe5c0118b095fe21521ea4e569 refs/heads/Task/150-Xamarin
(N.B. I've snipped most of them out.)
Following the documentation for git clone
I should (I think) be able to clone the remote repository but only taking the tip of one branch. Here are the versions of the command that I have tried
git clone --depth 1 --branch Task/150-Xamarin -- https://blah.visualstudio.com/Blah/_git/Software
git clone --depth 1 --branch heads/Task/150-Xamarin -- https://blah.visualstudio.com/Blah/_git/Software
git clone --depth 1 --branch refs/heads/Task/150-Xamarin -- https://blah.visualstudio.com/Blah/_git/Software
Every one of these return variations of the error
Cloning into 'Software'...
warning: Could not find remote branch Task/150-Xamarin -- to clone.
fatal: Remote branch Task/150-Xamarin -- not found in upstream origin
If I omit the --
I get a different error. For example from
git clone --depth 1 --branch Task/150-Xamarin https://blah.visualstudio.com/Blah/_git/Software
I get the error
You must specify a repository to clone.
I don't understand. The remote branch is listed by git ls-remote
why can't I get it in the shallow clone?