Key concepts

Tag

In Git, a tag is a reference to a specific point in the repository's history. Tags are used to mark important milestones or releases in the project's lifecycle. Unlike branches, tags are static and do not change once they are created.

Tags are commonly used for:

  1. Versioning releases: When a new version of the software is ready for release, a tag is created to mark that specific point in the commit history. For example, when releasing version 2.3.1 of a project, a tag named v2.3.1 can be created to reference the commit that represents this release.

    The prefix v is not required but often used to indicate that the tag represents a version number. This lets branches named X.Y.Z coexist with tags named vX.Y.Z.
  2. Marking important milestones: Tags can also be used to mark significant milestones in the project's development, such as the completion of a major feature or a critical bug fix. For instance, a tag named feature-x-completion can be created to mark the commit that introduces a new feature.

  3. Quick reference: Tags provide a convenient way to reference a specific point in the repository's history without having to remember or look up the commit hash. This is particularly useful when you need to quickly switch between different versions of the project.

Examples

Create a simple tag:

git tag v1.0.0

Create an annotated tag with a message:

git tag -a v1.2.0 -m "Release 1.2.0"

List all tags:

git tag

Check out a specific tag:

git checkout v1.2.0

Compare changes between a tag and the current HEAD:

git diff v1.2.0..HEAD
© 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