I need to clone a private repository from GitHub, but I only want to get a specific tag (so basically, cloning is actually the wrong term for it).
Now, the
Note: git clone --single-branch --branch tag can work but.. forget intermediate tags in case of tag chaining!
See commit b773dde, commit ab51783, commit 948a7fd, commit 2076353, commit 1962d9f (07 Sep 2016) by Jeff King (peff).
(Merged by Junio C Hamano -- gitster -- in commit 9883ec2, 15 Sep 2016)
pack-objects: walk tag chains for--include-tag"
git pack-objects --include-tag" was taught that when we know that we are sending an objectC, we want a tagBthat directly points atCbut also a tagAthat points at the tagB.
We used to miss the intermediate tagBin some cases.What happens if we have a chain of tags (e.g., tag "
A" points to tag "B", which points to commit "C")?We'll peel down to "
C" and realize that we want to include tag "A", but we do not ever consider tag "B", leading to a broken pack (assuming "B" was not otherwise selected).
This is fixed in Git 2.11 (Q4 2016)