What is git tags ? How to Use Git Tags (Create, List, Push & Delete) — Ariful Haque Sajib
Ariful Haque Sajib

Ariful Haque Sajib @arifulhaque313

About: Hi, I’m Md Ariful Haque Sajib, a Software Engineer shaping ideas into code — find me @arifulhaque313

Location:
Mirpur 1, DNCC, Dhaka, Bangladesh
Joined:
Apr 26, 2025

What is git tags ? How to Use Git Tags (Create, List, Push & Delete) — Ariful Haque Sajib

Publish Date: Jun 21
0 0

Learn Git tagging essentials with this step-by-step guide by Ariful Haque Sajib. Understand what Git tags are, why they’re useful, the types of tags (lightweight & annotated), and how to create, list, delete, and push tags efficiently. Perfect for developers mastering Git version control!

Git tags are a powerful feature that allow you to mark specific points in your repository’s history as important, typically used for release points (v1.0, v2.0, etc.). Here’s everything you need to know about Git tags.

What are Git Tags?
Tags are references to specific points in Git history. Unlike branches, tags are immutable — once created, they don’t move as you add new commits. They’re commonly used to:

  • Mark release versions (v1.0.0, v2.1.3)
  • Create stable points to refer back to
  • Provide meaningful names to specific commits

Types of Tags
There are two types of Git tags:

  • Lightweight tags: Just a pointer to a specific commit
  • Annotated tags: Store additional metadata (tagger name, email, date, message)

Why Use Tags?
Version control: Clearly mark release versions
Documentation: Annotated tags can include release notes
Deployment: Easily deploy specific versions
Reference: Quickly checkout important points in history

Useful Git Tag Commands

Creating Tags

# Create a lightweight tag
git tag v1.0.0

# Create an annotated tag (recommended for releases)
git tag -a v1.0.0 -m "Version 1.0.0 release"

# Tag a specific commit
git tag -a v1.0.0 abc1234 -m "Version 1.0.0"
Enter fullscreen mode Exit fullscreen mode

Listing Tags

# List all tags
git tag

# List tags with pattern matching
git tag -l "v1.*"

# Show tag details
git show v1.0.0
Enter fullscreen mode Exit fullscreen mode

Pushing Tags

# Push a specific tag to remote
git push origin v1.0.0

# Push all tags to remote
git push origin --tags
Enter fullscreen mode Exit fullscreen mode

Checking out Tags

# Checkout a tag (creates detached HEAD state)
git checkout v1.0.0

# Create a branch from a tag
git checkout -b version1 v1.0.0
Enter fullscreen mode Exit fullscreen mode

Deleting Tags

# Delete local tag
git tag -d v1.0.0

# Delete remote tag
git push origin --delete v1.0.0
Enter fullscreen mode Exit fullscreen mode

Advanced Usage

# Sign a tag with GPG
git tag -s v1.0.0 -m "Signed version 1.0.0"

# Verify a signed tag
git tag -v v1.0.0

# List tags with creation dates
git for-each-ref --sort=-taggerdate --format '%(refname:short) %(taggerdate:short)' refs/tag
Enter fullscreen mode Exit fullscreen mode

Git Tag vs Branch: Key Differences
Understanding the distinction between tags and branches is essential for effective Git workflow management. Here’s a detailed comparison:

Image description

*Example: *

Image description

Image description

Conclusion
Git tags are powerful tools for marking important points in your project’s history. Use annotated tags for releases, follow consistent naming conventions, and integrate them into your development workflow. They provide clear reference points for versions, enable easy rollbacks, and improve team collaboration around releases.

Remember: Tags are immutable references that help organize your project’s timeline and facilitate better version management.

I’m Md Ariful Haque Sajib, a Software Engineer 👨‍💻 at Adventure Dhaka Limited, specializing in PHP, Laravel, Spring Boot, Vue.js, and React.js. With expertise in E-commerce, Payment Gateways, APIs, various Management and Finance-based software. I am passionate about 🧠 learning and delivering 🌟 high-quality solutions.

📌 Follow me for updates and insights:
🌐 GitHub: ArifulHaque313
🔗 LinkedIn: Md Ariful Haque Sajib

📧 Contact: asajib7654@gmail.com

📢 Hashtags:

GitTags #Release

ArifulHaqueSajib #arifulhaque313 #sajib

Hope this makes it more visually appealing! 😊

Comments 0 total

    Add comment