Hi, I’m Erika Rowland (a.k.a. erikareads). Hi, I’m Erika. I’m an Ops-shaped Software Engineer, Toolmaker, and Resilience Engineering fan. I like Elixir, Reading, and Design. She/Her. If you're looking for experienced talent, I would love to chat. Published on

Git Checkout Tag

You can checkout a tag in a git repo by usingThis is pretty useful for exploring historical version of code bases. “What was this codebase like at release X?” I needed this in order to find a removed function in Erlang.:

$ git checkout <tag>

Simple as that.

Note that running this command without a branch will put you in “detached HEAD” state, meaning that any commits you make will be reachable only by their exact hash. If you want to make changes with a tag as your starting point, use -b <branch name> like this:

$ git checkout -b <branch name> <tag>

Read more in the git documentation.


When I initially looked up how to do this, I found instructions to use git checkout tags/<tag>.

This is contrary to git’s own documentation, but it worked!

This seems to work because tags are a ref in the refs/tags namespace, and git correctly identifies the right tag, and thus the right commit from there. I believe this is the same mechanism as when you give a short hash and git finds the correct commit.