I'm a bit puzzled why I'm unable to checkout a tag directly from the git clone command. What I try to do is:
git clone -b mytag <url>/foo.git
The error I get is:
warning: Remote branch mytag not found in upstream origin, using HEAD instead
Tag is present and e.g.
cd foo && git checkout mytag
...works well.
If anyone could share some light on why it's impossible to clone directly into a tag I would appreciate it. Thank you.
Perhaps all you really need/want to do is use git archive to pull a tarball of anything git rev-parse can understand. You can use the --remote option to pull the archive from some remote source identically to the <url>/foo.git value that you are passing to clone. In theory, this will be much quicker since all you will be grabbing is the working tree and not the entire repository.
Here's a "works for me" example:
% git archive --prefix foo/ --remote <url>/foo.git my-tag | tar -xf -
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With