Benefits of tagging releases in your git repository

Creating tags for every project release is an additional piece of documentation that can be extremely helpful in certain cases.

These  are some benefits:

  • It helps you keep track of the version number of your project, and refer to that release number when talking with other members of the team.
  • It allows you to document the release notes of your project, which is useful for your team and stakeholders.
  • It will make it easier for the DevOps team to roll back changes to the previous release in case something goes wrong with the new release that is being deployed.
  • It allows you to compare changes between two releases.
  • It allows you to deploy a previous release in your local in case you need to investigate when issues that are hard to identify were introduced.

Adding git tags to master

People usually add tags in the master branch for every release. Say that you need to tag master with version 1.4.1, you can do that with the following command:

(master)$ git tag –a 1.4.1 –m “Tagging 1.4.1 release.”

Then, you can push the tag to origin with this command:

(master)$ git push --tags

Checking out a git tag

If you ever need to checkout a tag to roll back changes, or simply to inspect what was on that version at certain point in time, you can execute the following commands, but please make sure you commit all changes in your current branch before doing that:

Say that you need to check out version 2.3.2. First off, get all the possible tags in the repo:

(master)$ git fetch

Then, checkout the tag with this command:

(master)$ git checkout tags/2.3.2

Do you need some help?

Let's get started. Tell us a little about yourself and your organization
and we can start a conversation about your needs and our capabilities.

Related Posts