I'm trying to figure out how I can download a particular tag of a Git repository - it's one version behind the current version.
I saw there was a tag for the previous version on the git web page, with object name of something long hex number.
But the version name is "Tagged release 1.1.5
" according the site.
I tried a command like this (with names changed):
git clone http://git.abc.net/git/abc.git my_abc
And I did get something - a directory, a bunch of subdirectories, etc.
If it's the whole repository, how do I get at the version I'm seeking? If not, how do I download that particular version?
git clone If you only need the specific tag, you can pass the --single-branch flag, which prevents fetching all the branches in the cloned repository. With the --single-branch flag, only the branch/tag specified by the --branch option is cloned. $ git clone -b <tagname> –single-branch <repository> .
Checkout Git Tag To fetch tags from your remote repository, use “git fetch” with the “–all” and the “–tags” options. Let's say for example that you have a tag named “v1. 0” that you want to check out in a branch named “release”. Using this command, you have successfully checked out the “v1.
Short Answergit checkout origin/master -- path/to/file // git checkout <local repo name (default is origin)>/<branch name> -- path/to/file will checkout the particular file from the downloaded changes (origin/master).
While on a branch, clicking “Download Zip” from the Code dropdown will lead you to a download for the specific branch you're on.
$ git clone
will give you the whole repository.
After the clone, you can list the tags with $ git tag -l
and then checkout a specific tag:
$ git checkout tags/<tag_name>
Even better, checkout and create a branch (otherwise you will be on a branch named after the revision number of tag):
$ git checkout tags/<tag_name> -b <branch_name>
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