Friday, July 7, 2017

How to Checkout a Specific Tag in Git

Here is a quick tip which shows how to checkout a specific tag in Git.
    $ git clone <repository-link>
    $ git checkout tags/<tag-name> -b <branch-name>
The first command clones the whole repository. The second one takes a specific tag and creates a branch for it. If there are any doubts regarding the tag name, a list of tags can be retrieved via the following command:
    $ git tag -l
Specifying a branch name is actually optional. It defaults to a revision number of a tag which might not be very convenient.