> ## Content Index
> Fetch the complete content index at: https://devopscube.com/llms.txt
> Use this file to discover other available public pages before exploring further.

# How To Checkout/Clone Git Tags
- URL: https://devopscube.com/checkout-clone-git-tags/
- Published: 2021-02-26T18:53:15.000Z
- Updated: 2025-03-12T16:36:43.000Z
- Author: devopscube
- Tags: GIT, GIT BASICS, #Migrated-1741795015845, #wp, #wp-post, #Import 2025-03-12 15:57, #blog

It's a common [DevOps practice](https://devopscube.com/what-is-devops-what-does-it-really-mean/) to tag a specific commit id whenever there is a release. Also, developers tag specific commits for several uses cases.

When it comes to the [application release process](https://devopscube.com/release-management-explained/), whenever there is a hotfix, the fix starts from the `commit id` that was tagged for release.

In this blog, you will learn the follwing.

1. Checkout a particular git tag
2. git clone from a tag
3. merge a git tag to a branch

## Checkout Git Tag

Let's look at different options associated with checking out a git tag.

### Checkout a Git Tag To Branch

Now that you know the list of available tags, you can check out a particular tag.

For example, if you want to checkout a tag `v.1.0` to a branch named `hotfix-1.0`, you can do so using the following git command.

```
git checkout tags/v.1.0 -b hotfix-1.0
```

### List Git Tags

When you clone a repository, all the tags associated with the repository will be pulled down.

To fetch all the remote tags, use the fetch command as shown below.

```
git fetch --tags
```

You can list down all the tags from the git repository using the following command.

```
git tag -l 
```

You can also search for tags with patterns.

```
git tag -l "v*"
```

To get the latest git tag, you can use the following command.

```
git describe --tags $(git rev-list --tags --max-count=1)
```

### Get Git Tag Information

If you get the commit id and other information associated with a tag using the following command.

```
git show v.1.0
```

![git tag information](https://storage.ghost.io/c/5f/2f/5f2f4d20-2abf-4534-8d40-7aa233aedd43/content/images/2025/03/tag-info-min-1.png)

## Clone from a git tag

Cloning a specific git tag is very useful for debugging and other purposes.

To clone a particular tag, you can use the clone command as shown below.

```
git clone -b <git-tagname> <repository-url> 
```

For example,

```
git clone -b v.1.0 
```

When you clone a tag, it will be in the detached HEAD state.

If you need to checkout to a new branch if you want to make changes to the tag as explained above.

![Clone from a git tag](https://storage.ghost.io/c/5f/2f/5f2f4d20-2abf-4534-8d40-7aa233aedd43/content/images/2025/03/detached-state-min-1.png)

## Merge a git tag to a branch

Following command merges a particular tag to the current branch.

```
git merge tag_name
```

Let's say you want to merge the latest tag to the current branch, you can use the following command.

```
git merge $(git describe --tags $(git rev-list --tags --max-count=1))
```

If it a local branch, you can push the changes to the [upstream branch](https://devopscube.com/set-git-upstream-respository-branch/).

## Conclusion

Git tagging is very important when it comes to CI/CD pipeline.

Make sure you follow the right set of practices in git tagging and creating branches from git tags.