Download a Specific Tag with Git

Better Stack Team
Updated on June 24, 2024

To download a specific tag with Git, you can use the git checkout command along with the tag name. Here's how:

 
git checkout tags/<tag-name>

Replace <tag-name> with the name of the tag you want to download.

For example, if you want to download a tag named "v1.0.0", you would run:

 
git checkout tags/v1.0.0

This command checks out the specific tag, which means it puts your repository in a state that corresponds to the code at the time of that tag.

Note:

  • After running git checkout, you'll be in a "detached HEAD" state, meaning you're not on a branch but directly on the commit corresponding to the tag.
  • If you want to work with the code from the tag and make changes, you should create a new branch from the tag to work on:

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

    Replace <new-branch-name> with the name you want to give to the new branch.

Make your mark

Join the writer's program

Are you a developer and love writing and sharing your knowledge with the world? Join our guest writing program and get paid for writing amazing technical guides. We'll get them to the right readers that will appreciate them.

Write for us
Writer of the month
Marin Bezhanov
Marin is a software engineer and architect with a broad range of experience working...
Build on top of Better Stack

Write a script, app or project on top of Better Stack and share it with the world. Make a public repository and share it with us at our email.

community@betterstack.com

or submit a pull request and help us build better products for everyone.

See the full list of amazing projects on github