Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
248 views
in Technique[技术] by (71.8m points)

git - 使用Git下载特定标签(Download a specific tag with 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.

(我在git网页上看到了以前版本的标签,对象名称为长十六进制数。)

But the version name is " Tagged release 1.1.5 " according the site.

(但根据网站版本名称是“ Tagged release 1.1.5 ”。)

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?

(如果没有,我该如何下载该特定版本?)

  ask by Jack BeNimble translate from so

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Answer

0 votes
by (71.8m points)
$ 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 tag -l列出$ git tag -l ,然后签出特定标记:)

$ 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>

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...