---
title: "How do you tag a specific commit in GitHub and why?"  
description: "How do you tag a specific commit in GitHub and why?"  
author: "Shalini Passi"  
published: 2025-07-04  
updated: 2026-05-15  
canonical: https://www.mindstick.com/forum/161790/how-do-you-tag-a-specific-commit-in-github-and-why  
category: "GitHub"  
tags: ["git"]  
reading_time: 4 minutes  

---

# How do you tag a specific commit in GitHub and why?

**How do you tag a specific [commit](https://www.mindstick.com/forum/157683/explain-commit-rollback-and-savepoint-statements-with-examples-in-pl-sql) in GitHub and why?**

## Replies

### Reply by ICSM Computer

Git tags are used to mark important points in a repository’s history, usually for:

- releases
- versions
- production deployments
- milestones

A tag points to a specific commit and acts like a permanent bookmark.

Example:

- `v1.0`
- `v2.1.5`
- `production-release`
- `stable-build`

## Why Use Git Tags?

Tags are important because they help teams:

- track software versions
- identify production releases
- rollback to stable versions
- simplify deployments
- maintain release history

Without tags, finding a specific release commit becomes difficult.

## Common Use Cases

| Use Case | Example |
| --- | --- |
| Production release | `v1.0.0` |
| Hotfix release | `v1.0.1` |
| Beta version | `v2.0-beta` |
| Deployment snapshot | `prod-apr-2026` |

## Types of Git Tags

## 1. Lightweight Tag

Simple pointer to a commit.

```plaintext
git tag v1.0
```

## 2. Annotated Tag

Stores:

- tagger name
- email
- date
- message

Recommended for production releases.

```plaintext
git tag -a v1.0 -m "First production release"
```

## How to Tag a Specific Commit

## Step 1: View Commit History

```plaintext
git log --oneline
```

Example:

```plaintext
d8f5c12 Fix payment bug
a3b9f77 Add login feature
e2d4k88 Initial commit
```

## Step 2: Tag the Specific Commit

Syntax:

```plaintext
git tag -a <tag-name> <commit-id> -m "message"
```

Example:

```plaintext
git tag -a v1.0 a3b9f77 -m "Stable release version 1.0"
```

This tags commit:

- `a3b9f77`

with:

- `v1.0`

## Step 3: Push Tag to GitHub

By default, tags are local.

Push a single tag:

```plaintext
git push origin v1.0
```

Push all tags:

```plaintext
git push --tags
```

Now the tag appears on:

[GitHub](https://github.com/?utm_source=chatgpt.com)

## How to View Tags

List all tags:

```plaintext
git tag
```

Detailed tag information:

```plaintext
git show v1.0
```

## Checkout a Tagged Version

```plaintext
git checkout v1.0
```

This allows you to:

- inspect old releases
- debug production issues
- restore previous versions

## Delete a Tag

## Delete Local Tag

```plaintext
git tag -d v1.0
```

## Delete Remote Tag

```plaintext
git push origin --delete v1.0
```

## Semantic Versioning (Best Practice)

Most teams follow:

```plaintext
MAJOR.MINOR.PATCH
```

Example:

| Version | Meaning |
| --- | --- |
| `1.0.0` | Initial release |
| `1.1.0` | New feature |
| `1.1.1` | Bug fix |

## Real-World Example

Imagine:

Version `v2.5` deployed to production

New deployment introduces bugs

Using tags:

```plaintext
git checkout v2.5
```

- You can quickly rollback to the stable release.
- This is why tags are critical in production systems.

## Difference Between Branches and Tags

| Branch | Tag |
| --- | --- |
| Moves forward with commits | Fixed snapshot |
| Used for development | Used for releases |
| Mutable | Immutable (usually) |

## GitHub Release Tags

GitHub allows creating official releases from tags.

Example:

- Release notes
- binaries
- changelog
- downloadable artifacts

This is commonly used in:

- open-source projects
- enterprise deployments
- CI/CD pipelines

## Best Practices

## Use Annotated Tags

Prefer:

```plaintext
git tag -a
```

instead of lightweight tags.

## Follow Naming Standards

Good examples:

- `v1.0.0`
- `release-2026-05`
- `prod-stable`

## Tag Production Releases Only

Avoid excessive tagging.

## Protect Release Tags

Important release tags should not be modified or deleted.

## Conclusion

Git tags are essential for version control and production release management. They provide a stable reference point for important commits and make deployments, rollbacks, and release tracking significantly easier.

By tagging commits properly, teams can:

- manage versions cleanly
- deploy confidently
- rollback safely
- maintain release history efficiently

In modern DevOps and CI/CD workflows, Git tagging is a fundamental best practice.


---

Original Source: https://www.mindstick.com/forum/161790/how-do-you-tag-a-specific-commit-in-github-and-why

Copyright © MindStick Software Pvt. Ltd. This Markdown version is provided for developers, AI systems, and offline reading.
