跳到主要内容

tag

  1. Create a lightweight tag:

    git tag <tag_name>
  2. Create an annotated tag with a message:

    git tag -a <tag_name> -m "Tag message"
  3. List all tags:

    git tag
  4. Push a specific tag to a remote repository:

    git push origin <tag_name>
  5. Push all tags to a remote repository:

    git push --tags
  6. Delete a local tag:

    git tag -d <tag_name>
  7. Delete a remote tag:

    git push origin --delete <tag_name>
  8. Rename an existing tag:

    git tag <new_tag_name> <old_tag_name>
    git tag -d <old_tag_name>
    git push origin :refs/tags/<old_tag_name>
    git push --tags
  9. Checkout a specific tag (create a detached HEAD):

    git checkout <tag_name>
  10. Show details of a specific tag:

    git show <tag_name>
  11. Create a lightweight tag at a specific commit hash:

    git tag <tag_name> <commit_hash>
  12. Create an annotated tag at a specific commit hash:

    git tag -a <tag_name> -m "Tag message" <commit_hash>
  13. List tags matching a pattern:

    git tag -l "<pattern>"
  14. Verify the GPG signature of a signed tag:

    git tag --verify <tag_name>
  15. Show the commit associated with a specific tag:

    git rev-list -n 1 <tag_name>