Tags

Git tags are milestones that can be used to mark specific commits in the history of a repository.

With proper tagging, it becomes much easier to go back in time to reference specific events without having to comb through all the commits and lines of code.

How to create tags

When to create tags

Tags should be created at the head of a branch whenever the branch is deployed to its target environment.

Doing this will allow us to easily refer to the source code that has been deployed.

Versioning

To standardise the way we version tags, we will follow Semantic Versioning .

Given a version number MAJOR.MINOR.PATCH, increment:

  • PATCH version when making backward compatible bug fixes
  • MINOR version when adding new features in a backward compatible manner
  • MAJOR version when making any API changes that are incompatible with existing code

Typically, the initial version would be 0.1.0. The corresponding tag for it would be v0.1.0.