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.
As far as I can tell you'r doing it right.
Downloading the repo will include all the tags, unless you have configured git not to download tags.
When you check out a tag (using
git checkout 1.2is sufficient) you do indeed end up in datached head mode. But that should not be a problem. (Rungit checkout masterto return to HEAD).After checking out the tag, your working directory should now be at the point that the project was when they tagged the release.
What you might want to do at this point is remove all generated or cached files and build the project from scratch. How to do this depends on the code and the build system. If the project uses
make, runningmake cleanusually should do.