Manage project version numbers using tags

ZuoPengFei 2017.12.04

1. What is tag? When should you create a tag?

In project versioning, the tag function is used whenever a release is released and a record is needed so that a specific release can be found later.

The tag in Git refers to the ID of a commit and is usually used to mark a development branch, such as a version number.

2. What is the difference between Tag and Branch?

  • A branch is a branch; Tag is a milestone, a point on the branch;
  • A tag is a read-only branch; Typically, each releasable milestone is tagged;
  • For example, branch 1.0, 1.1, etc., can have 1.0.1, 1.0.2 tags in branch 1.0.
  • A tag is like a milestone, a mark, a point; Branch is a new journey, a line;
  • Tag is static, branch goes forward;
  • Stable versions are backed up with tags, and new features are developed with branch (merge to master after development).

3. Related operation commands

3.1 to play tag

Git tag-a 0.1.3 -m "Release version 0.1.3"Copy the code
  • Git tags are commands
  • -a 0.1.3 adds a label named 0.1.3
  • -m is followed by comments for the tag

The tagging happens after we commit the changes to the local repository.

3.2 submit

Git add. Git commit -m "fixed some bugs" git tag -a 0.1.3 -m "Release version 0.1.3"Copy the code

3.3 Submitting labels to the Remote Server

git push origin master
git push origin --tags

Copy the code
  • – Tags indicates that all tags are submitted to the server. The common Git push origin master operation does not push tags to the server.
  • If you specify a tag for a featuregit push origin [tagname]

3.4 Command for Deleting labels

Git 0.1.3 tag - dCopy the code

3. 5 Delete the label of the remote server

Git push origin: refs/tags / 0.1.3Copy the code

The resources

  • Git tag
  • Git basics – Tagging
  • GitHub combat series ~ release version of the branch operation +Tag explanation