What is git tag, How to create tags & How to checkout git remote tag(s)

10    Asked by JuliaGraham in Devops , Asked on Apr 29, 2025

How do you create a tag, list all available tags, and checkout a remote Git tag easily? Let's explore the answers step-by-step to better organize your project versions!

Answered by AaronMarquardt

In Git, a tag is a way to mark a specific point in your repository’s history, usually used for marking release versions (like v1.0, v2.0, etc.). Think of tags as bookmarks that help you quickly find important commits.

How to create a Git tag:

To create a simple lightweight tag, use:

  git tag tagname

To create an annotated tag (recommended for important releases):

  git tag -a tagname -m "your message here"

How to push a tag to a remote repository:

After creating a tag locally, push it to remote:

  git push origin tagname

  • How to list all available tags:
  • To see all the tags in your repository:

  git tag

How to checkout a remote Git tag:

First, fetch all tags:

  git fetch --tags

Then checkout the tag:

  git checkout tagname

 Note: When you checkout a tag, you are in a detached HEAD state, meaning you're not on a branch. If you want to work from that tag, you should create a new branch:

  git checkout -b new-branch-name tagname

Would you also like me to prepare a quick cheatsheet graphic for this?



Your Answer

Interviews

Parent Categories