How to "checkout" a Git Tag?

You can checkout a tag in git by using the following command:

git checkout tags/<tag-name> -b <new-local-branch>

If you exclude the -b flag, a new local branch will not be created, and you end up in a detached HEAD state.

You can list all tags by using the git tag command to see which tags are available.


This post was published by Daniyal Hamid. Daniyal currently works as the Head of Engineering in Germany and has 20+ years of experience in software engineering, design and marketing. Please show your love and support by sharing this post.