Download a specific tag with Git

Jack BeNimble picture Jack BeNimble · Apr 27, 2009 · Viewed 1.4M times · Source

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?

Answer

besen picture besen · Apr 27, 2009
$ 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>