Home Career and Growth Using Git Tags to Mark Important Moments in Our Project

Using Git Tags to Mark Important Moments in Our Project

274
0

When we work with Git, our project keeps growing with many commits. Sometimes we want to mark a specific moment in our project—like a version release, milestone, or stable point. This is where Git tags come in.

Git tags let us create meaningful labels for important commits, making them easy to find later.


1. What Are Git Tags?

A Git tag is a pointer to a specific commit—like a bookmark.

Developers commonly use tags to mark:

  • Releases: v1.0, v2.1.3
  • Milestones: beta, rc1 (release candidate)
  • Special points: initial-release, demo-version

Tags help you say:

👉 “This is a stable version of my code.”


2. Types of Git Tags

Git supports two types:

1. Lightweight Tags

A simple label pointing to a commit.

  • No extra data
  • Just a name
  • Used for quick or temporary tagging

Example:

git tag v1.0

2. Annotated Tags (Recommended)

These include:

  • Tagger name
  • Date
  • Message
  • Optional GPG signature

They’re great for releases because they store more information.

Example:

git tag -a v1.0 -m "Release version 1.0"

3. Creating Tags

Create a lightweight tag

git tag v1.0

Create an annotated tag

git tag -a v1.0 -m "Release version 1.0"

4. Tagging Older Commits

You can tag any past commit by adding its commit ID:

git tag -a v0.9 3a4b2c1 -m "Old stable version"

5. Listing All Tags

git tag

Output example:

v0.9
v1.0
v1.1
v2.0-beta

You can also search for tags using wildcard patterns:

git tag -l "v1.*"

6. Pushing Tags to a Remote Repository

Push one tag

git push origin v1.0

Push all tags

git push --tags

Important:
Tags are not pushed automatically.
You must push them manually.


7. Checking Out a Tag

You can view the project as it was at the time of the tag:

git checkout v1.0

⚠️ This puts you in a detached HEAD state — meaning you’re not on a branch.

If you want to work from that tag:

git checkout -b new-branch-name v1.0

8. Deleting Tags

Delete locally

git tag -d v1.0

Delete from remote

git push origin --delete v1.0

9. Why Are Tags Useful?

✔ Easy to mark releases

Production releases are always tagged.

✔ Useful for CI/CD pipelines

Build tools use tags to trigger deployment based on version numbers.

✔ Helps track project history

You can easily compare versions, rollback, or test stable points.

✔ Works perfectly with semantic versioning

Examples:

  • v1.0.0
  • v1.0.1
  • v2.1.3

10. Real-World Use Cases for Git Tags

Tags aren’t just a Git feature — they’re an essential part of real-world software development.

Here are the most common scenarios:


A. Release Management (Most Common Use Case)

Imagine your team completes the first stable version of your app.
Before deploying it to production, you tag the release:

git tag -a v1.0 -m "First stable release"
git push origin v1.0

Why this matters

  • CI/CD tools can auto-deploy based on the tag.
  • Teams can revisit the exact code shipped in v1.0.
  • Easy to compare versions: git diff v1.0 v1.1

If there’s an issue in production:

git checkout v1.0

And the old version is instantly reproducible.


B. Client Demo or Milestone Build

Say you give a demo to a client.

You tag that commit:

git tag -a demo-jan-2025 -m "January demo build"
git push origin demo-jan-2025

Later, if someone asks:

“Can we rebuild the exact version we showed in January?”

You can reproduce it instantly.


C. Versioning for Libraries / Packages

If you’re publishing:

  • NPM packages
  • Python libraries
  • Docker images
  • Terraform modules

Versioning depends on tags like:

  • v1.0.0
  • v1.1.2
  • v2.0.0

Automation tools fetch code directly from tags.


D. Marking Important Events

Teams often tag:

  • The first working prototype
  • Security patches
  • Hotfixes
  • Internal review builds

Having these marked makes long-term maintenance much easier.


11. Summary Table

TaskCommand
List tagsgit tag
Create lightweight taggit tag v1.0
Create annotated taggit tag -a v1.0 -m "message"
Tag old commitgit tag -a v1.0 <commit>
Push taggit push origin v1.0
Push all tagsgit push --tags
Delete local taggit tag -d v1.0
Delete remote taggit push origin --delete v1.0
Checkout taggit checkout v1.0

Final Thoughts

Git tags make it easy to identify important points in your project’s history.
Whether you’re releasing version 1.0 or marking a demo milestone, tags help you keep your repository organized and professional.

Previous articleHandling Merge Conflicts with Git
Next articleCloning a GitHub Repository into Our Local Machine
Heartin Kanikathottu
As a seasoned Cloud and Security Architect, I’ve led transformative initiatives in key roles, including Vice President at Morgan Stanley, Principal Architect at Societe Generale, and Tech Lead & Cloud Security Architect at VMware, among others. I’m also an internationally published author with multiple books available on platforms like Amazon and O'Reilly. Notably, one of my books was recognized as the 8th best cloud computing book of all time in 2020, reflecting the impact of my contributions to the field. With over 15 professional certifications from providers such as Microsoft (Azure), Amazon (AWS), Oracle (Java), Pivotal (Spring), and IBM, I bring a wealth of expertise to my work. Academically, I hold dual Master’s degrees in Cloud Computing and Data Analytics. I’m passionate about sharing knowledge and mentoring others, which is why I actively speak at global technical forums such as Tech Opportunities Fest at Platform Calgary, Google's Kubernetes Meetup, Java User Group, Elasticsearch Meetup, and the Agile India Conference.

LEAVE A REPLY

Please enter your comment!
Please enter your name here