跳到主要内容

Tags

A tag in Git is a feature used to mark specific commit versions in the code repository, typically used to identify release versions or important milestones. Through tags, you can quickly locate specific versions, making version management, releases, and rollbacks easier. You can use tags to clearly mark key project versions, helping the team collaborate and maintain the code more efficiently.

Main Functions of Tags


  • Version Control for Releases: Tags can be used to mark software release versions, such as v1.0, v2.0, etc.
  • Milestone Marking: Tags can be used to mark important stages in project development, such as Beta, Release Candidate, etc.
  • Quick Rollback: If problems are found in a tagged version, you can quickly revert to the commit corresponding to the tag.
  • Branch Management: Tagging branches is a common branch management strategy.
提示
  1. Tag naming usually involves adding the letter "v" before the version name. Some good tag names might be v1.0.0 or v2.3.4.
  2. If the tag is not suitable for production use, add a pre-release version after the version name. Some good pre-release versions might be v0.2.0-alpha or v5.9-beta.3.

Accessing the Tag List


  1. Click on "Tags" on the project homepage to enter the tag list.

    image-20241226153656514

  2. The project list page shows all the tags in the project. Here, you can create or delete tags.

    image-20241226153738522

Creating a Tag


On the tag list page, click "Create Tag", select the branch for the tag, and input the name and description to create the tag.

image-20241227143224814

Deleting a Tag


Click "Delete" -> "Confirm" on the tag list page to delete the tag.

image-20241227143353310

注意

Deleting a tag will also delete the associated release.

How to Use Tags


  1. Browse all tags on the project's Tags page.
  2. View the code snapshot at the corresponding point by selecting a tag.
  3. Compare differences between different tags.
  4. Check out the version corresponding to the tag by entering git checkout + tag name in the terminal.
  5. Use git diff to view the differences between the tag version and the current code.
  • Use semantic versioning for tag names.
  • Keep tag descriptions concise and clear.
  • Do not delete published tags.
  • Regularly add tags for key milestones.
  • Recommend using lightweight tags.

On GitCode, the Tags feature makes version control simple and easy to use. Properly utilizing tags can better manage project releases and milestones, helping the team collaborate and maintain the code more efficiently.