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
386 views
in Technique[技术] by (71.8m points)

git - 在GitHub存储库中创建标记(Create a tag in a GitHub repository)

I have a repository in GitHub and I need to tag it.

(我在GitHub中有一个存储库,我需要标记它。)

I tagged in a shell, but on GitHub it is not showing up.

(我在shell中标记,但在GitHub上它没有显示出来。)

Do I have to do anything else?

(我还有什么要做的吗?)

The command I used in the shell is:

(我在shell中使用的命令是:)

git tag 2.0

And now when I type git tag it shows:

(现在,当我键入git tag它显示:)

2.0

So it seems like tags are present, correct?

(所以似乎标签存在,对吗?)

The repository is: https://github.com/keevitaja/myseo-pyrocms .

(存储库是: https//github.com/keevitaja/myseo-pyrocms 。)

How do I make this tag show up on GitHub?

(如何让这个标签显示在GitHub上?)

Where are my tags?

(我的标签在哪里?)

  ask by Tanel Tammik translate from so

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

1 Answer

0 votes
by (71.8m points)

You can create tags for GitHub by either using:

(您可以使用以下命令为GitHub创建标记:)

  • the Git command line, or

    (Git命令行,或)

  • GitHub's web interface.

    (GitHub的网络界面。)

Creating tags from the command line (从命令行创建标记)

To create a tag on your current branch, run this:

(要在当前分支上创建标记,请运行以下命令:)

git tag <tagname>

If you want to include a description with your tag, add -a to create an annotated tag :

(如果要在标记中包含说明,请添加-a以创建带注释的标记 :)

git tag <tagname> -a

This will create a local tag with the current state of the branch you are on.

(这将创建一个local标记,其中包含您所在分支的当前状态。)

When pushing to your remote repo, tags are NOT included by default.

(推送到远程仓库时,默认情况下不包含标签。)

You will need to explicitly say that you want to push your tags to your remote repo:

(您需要明确说明要将标签推送到远程仓库:)

git push origin --tags

From the official Linux Kernel Git documentation for git push :

(从git push官方Linux Kernel Git文档中 :)

 --tags 

All refs under refs/tags are pushed, in addition to refspecs explicitly listed on the command line.

(除了在命令行中明确列出的refspec之外,还会推送refs / tags下的所有引用。)

Or if you just want to push a single tag:

(或者,如果您只想推送单个标签:)

git push origin <tag>

See also my answer to How to push a tag to a remote repository using Git?

(另请参阅我如何使用Git将标签推送到远程存储库的答案)

for more details about that syntax above.

(有关上述语法的更多详细信息。)

Creating tags through GitHub's web interface (通过GitHub的Web界面创建标签)

You can find GitHub's instructions for this at their Creating Releases help page .

(您可以在他们的创建版本帮助页面上找到GitHub的相关说明。)

Here is a summary:

(以下是摘要:)

  1. Click the releases link on our repository page,

    (单击我们的存储库页面上的版本链接,)

    截图1

  2. Click on Create a new release or Draft a new release ,

    (单击“ 创建新版本”或“ 草拟新版本” ,)

    截图2

  3. Fill out the form fields, then click Publish release at the bottom,

    (填写表单字段,然后单击底部的发布版本 ,)

    截图3截图4

  4. After you create your tag on GitHub, you might want to fetch it into your local repository too:

    (在GitHub上创建标记后,您可能还想将其提取到本地存储库中:)

     git fetch 

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

...