In Git, tags are references that point to a specific point in time, and are commonly used to identify release versions of your code.
We’re going to go over how to checkout a Git tag using the cross-platform GitKraken Git client before walking you through how to checkout a tag in the CLI.
In GitKraken, you have immediate visibility to see all of the tags in your repository, listed clearly in the left panel of the main UI. You can also filter and search tags from this location, which can be especially convenient for large repos.
To checkout a tag in GitKraken, simply right-click a tag from the central graph, where tags are denoted with a 🏷 tag icon. From here, you can select Checkout this commit to checkout the tag in a detached head state.
To checkout a Git tag as a branch in GitKraken, right-click a tag from the left panel or central graph and select Create branch here from the context menu.
If you’re using the command line, you won’t be able to see a list of your tags neatly lined up on the left of your UI, like you can in GitKraken. To see which tags exist in your Git repository, you can run the git tag command to view a list of your Git tags.
From here, you can checkout a tag in a detached head state or as a branch. Let’s start with how to checkout a Git tag in a detached head state. This can be accomplished with the following:
git checkout <tag name>
Alternatively, you can checkout a Git tag as a branch with the following:
git checkout -b <branch name> <tag name>