使用 Git 下载特定标签 [英] Download a specific tag with Git
问题描述
我想弄清楚如何下载 Git 存储库的特定标签 - 它比当前版本落后一个版本.
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.
我看到 git 网页上有一个以前版本的标签,对象名称是一个很长的十六进制数字.
I saw there was a tag for the previous version on the git web page, with object name of something long hex number.
但根据网站,版本名称是Tagged release 1.1.5
".
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
会给你整个存储库.
克隆后,您可以使用 $ git tag -l
列出标签,然后检出特定标签:
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>
这篇关于使用 Git 下载特定标签的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!