Wednesday 2 October 2019

Git: Clone a specific tag


Syntax
git clone <repo_url> --branch <tag_name>

For example, gitTaggingDemo repository two tags (https://github.com/harikrishna553/gitTaggingDemo.git).


You can clone v1.1 by executing below command.

$git clone https://github.com/harikrishna553/gitTaggingDemo.git --branch v1.1
Cloning into 'gitTaggingDemo'...
remote: Enumerating objects: 13, done.
remote: Counting objects: 100% (13/13), done.
remote: Compressing objects: 100% (6/6), done.
remote: Total 13 (delta 0), reused 13 (delta 0), pack-reused 0
Unpacking objects: 100% (13/13), done.
Note: checking out '2c389dc281395917105cf51f48bcc20c27ba51f4'.

You are in 'detached HEAD' state. You can look around, make experimental
changes and commit them, and you can discard any commits you make in this
state without impacting any branches by performing another checkout.

If you want to create a new branch to retain commits you create, you may
do so (now or later) by using -b with the checkout command again. Example:

  git checkout -b <new-branch-name>


Previous                                                    Next                                                    Home

No comments:

Post a Comment