How to checkout a Git tag - Rocketeers

  [ Rocketeers ](/)   

[Login](https://rocketeersapp.com) 

 On this page

 Knowledge
---------

How to checkout a Git tag
=========================

### [\#Development](https://rocketee.rs/index.php/development)

Checking out a tag puts you in a detached HEAD state, which is fine for inspecting a release but not for committing. If you want to make changes, create a branch from the tag.

 Published by [Mark van Eijk](https://rocketee.rs/index.php/author/mark-van-eijk) on June 23, 2026 · 1 minute read

1. [Checkout a tag](#content-checkout-a-tag)
2. [You are now in detached HEAD](#content-you-are-now-in-detached-head)
3. [Make changes from a tag: create a branch](#content-make-changes-from-a-tag-create-a-branch)
4. [The tag is missing?](#content-the-tag-is-missing)

[\#](#content-checkout-a-tag "Permalink")Checkout a tag
-------------------------------------------------------

A tag points at a specific commit, usually a release. Check it out by name:

 ```
git checkout v1.2.0

```

To be unambiguous (in case a branch and a tag share a name), use the full ref:

 ```
git checkout tags/v1.2.0

```

[\#](#content-you-are-now-in-detached-head "Permalink")You are now in detached HEAD
-----------------------------------------------------------------------------------

After checking out a tag, Git warns you that you are in a **detached HEAD** state. That means `HEAD` points directly at a commit instead of a branch. You can look around, build, and run the code, but any commits you make here are not on a branch and will be lost once you switch away.

[\#](#content-make-changes-from-a-tag-create-a-branch "Permalink")Make changes from a tag: create a branch
----------------------------------------------------------------------------------------------------------

If you need to work from a tagged release, for example to patch an old version, create a branch from the tag:

 ```
git checkout -b hotfix-1.2.0 v1.2.0

```

The modern equivalent uses `git switch`:

 ```
git switch --detach v1.2.0      # just inspect
git switch -c hotfix-1.2.0 v1.2.0  # branch off the tag

```

[\#](#content-the-tag-is-missing "Permalink")The tag is missing?
----------------------------------------------------------------

If `git checkout v1.2.0` fails with `pathspec ... did not match`, your clone probably does not have the tag yet. Fetch tags from the remote:

 ```
git fetch --tags

```

List the tags you have to confirm the exact name:

 ```
git tag

```

### Subscribe to our newsletter

Do you want to receive regular updates with fresh and exclusive content to learn more about web development, hosting, security and performance? Subscribe now!

  Fill in your email address to receive updates  Subscribe 

#### More in [\#Development](https://rocketee.rs/index.php/development)

- [Install PHP memcached extension on macOS](https://rocketee.rs/index.php/install-php-memcached-extension-on-macos)
- [How to delete a local (and remote) Git branch](https://rocketee.rs/index.php/git-delete-local-branch)
- [Fix: Cannot connect to the Docker daemon at unix:///var/run/docker.sock](https://rocketee.rs/index.php/cannot-connect-to-docker-daemon)
- [git stash pop vs apply: save and restore changes](https://rocketee.rs/index.php/git-stash-pop)
- [How to clean up Docker with prune (images, volumes, system)](https://rocketee.rs/index.php/docker-prune)
- [What port does SSH use (and how to change it)](https://rocketee.rs/index.php/ssh-port)

 [View all 12 articles →](https://rocketee.rs/index.php/development)
