There's a repository I want to build from, however if I clone the repository, the source I get results in an unstable program. The last version of the source they tagged (1.2) is stable but I'm not sure how to download it using git. From what I've been reading when searching for answers I can clone the repository first then use checkout
to switch to the tag;
git clone https://github/project/project.git
cd project
git checkout tags/1.2
This results in detached head mode which I'm not sure is a problem or not. However what I don't get is, when I do checkout it says it switches to the tag in the "working tree". Does that mean now that if I build it with the scripts the dev team included to do so it will build the 1.2 source code only? I did so and I got a program that seemed unstable still. However I can't tell what version it is because it doesn't say (they're fixing that in a later release).
So did I do this correctly? Or am I barking up the wrong tree by using checkout. I mean, ideally I would like to be able to download the source for that tag without having to clone the entire repository but I can't seem to figure out how to do that, if it's even possible.
You can do like this:
To fetch a specific tag without other commit history.
--branch
parameter can take a tag name as well as branch name in modern versions of git, like explained in this answer.--depth 1
results in a shallow clone, doing a checkout without further history. Shallow clone is explained in detail for example here. The example repo I used, jquery, is big enough that you can observe the difference.This will result in detached state, which is how it's meant to be.