Create a tag in a GitHub repository

后端 未结 7 1557
逝去的感伤
逝去的感伤 2020-12-02 03:04

I have a repository in GitHub and I need to tag it.
I tagged in a shell, but on GitHub, it is not showing up.

Do I have to do

7条回答
  •  野趣味
    野趣味 (楼主)
    2020-12-02 03:41

    You can create tags for GitHub by either using:

    • the Git command line, or
    • GitHub's web interface.

    Creating tags from the command line

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

    git tag 
    

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

    git tag  -a
    

    This will create a local tag with the current state of the branch you are on. 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:

    --tags
    

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

    Or if you just want to push a single tag:

    git push origin 
    

    See also my answer to How do you push a tag to a remote repository using Git? for more details about that syntax above.

    Creating tags through GitHub's web interface

    You can find GitHub's instructions for this at their Creating Releases help page. Here is a summary:

    1. Click the releases link on our repository page,

      Screenshot 1

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

      Screenshot 2

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

      Screenshot 3 Screenshot 4

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

      git fetch
      

    Now next time, you may want to create one more tag within the same release from website. For that follow these steps:

    Go to release tab

    1. Click on edit button for the release

    2. Provide name of the new tag ABC_DEF_V_5_3_T_2 and hit tab

    3. After hitting tab, UI will show this message: Excellent! This tag will be created from the target when you publish this release. Also UI will provide an option to select the branch/commit

    4. Select branch or commit

    5. Check "This is a pre-release" checkbox for qa tag and uncheck it if the tag is created for Prod tag.

    6. After that click on "Update Release"

    7. This will create a new Tag within the existing Release.

提交回复
热议问题