Git commands

git tag

git tag: tag a Git commit

The git tag command is used to create tags in your Git repository. Tags are like labels or milestones that you can use to mark important points in your project's history, such as release versions (v1.0.0, v2.0.0). They are similar to branches but cannot be moved once created - they are fixed points.

Creating tags does not change the repository itself (the commits that are tagged remain identical). Instead, it helps to provide more context and milestones within the project's development, making it easier for teams and contributors to track progress, revert to stable versions, and understand the history of changes. They are also helpful for build or release automation, as tools can use tags to identify which version to package or deploy.

Tags in Git come in two types:

  • Lightweight tags are simple pointers to specific commits. These tags are mainly used for referencing commits with human-readable names.

  • Annotated tags are stored as full objects in the Git database, including the tagger name, email, date, and a tagging message. They can be GPG signed and verified for security and trust. These tags are recommended for marking official release versions because they contain additional information.

Examples

Create an annotated tag named v1.0.0:

git tag -a v1.0.0 -m "Release version 1.0.0"

Create a lightweight tag named v1.0.1:

git tag v1.0.1

List all tags:

git tag

Delete a tag named v1.0.1:

git tag -d v1.0.1

Push all tags to a remote repository:

git push origin --tags

Push a specific tag to a remote repository:

git push origin v1.0.0
© 2024-2025 GitByBit.All rights reserved.

Hi! I'm Alex, creator of GitByBit.

And this is Gitopedia—a reference that summarizes knowledge in my Git course.

Gitopedia is designed to be a personal knowledge base. When you progress through the main Git course in VS Code, you unlock all of these topics, one by one, bit by bit. This gives you time to digest the information and gradually build the mental model of Git. Here's an example of how it works:

Learning directly in VS Code lets you practice Git exactly as you would in real life, doing real jobs, writing real code. In addition, the course has access to your actual terminal, so it can point out mistakes, suggest workarounds, etc.

The course is FREE, there are no Ads or other bullshit. There are optional premium add-ons you can purchase, mainly to support my work (regrettably, I have to eat every day), but that's totally up to you.

Learn Git in VS Code