Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to get to a particular git tag

Tags:

git

github

I want v0.1.27 of nodejs code base.

This is what I did.

git clone git://github.com/ry/node.git 
cd node
git checkout -b v0.1.27 

However when I look at v0.1.27 code base changelog there I see changelog for 0.1.32 also. It seems I did not checkout v0.1.27.

How do I checkout a branch from a tag?

like image 554
Nick Vanderbilt Avatar asked Mar 25 '10 17:03

Nick Vanderbilt


People also ask

How do I switch to a specific tag in git?

To switch to a normal branch, use git switch <branch-name> . To switch to a commit-like object, including single commits and tags, use git switch --detach <commitish> , where <commitish> is the tag name or commit number.

How do I see git tags?

Listing the available tags in Git is straightforward. Just type git tag (with optional -l or --list ). You can also search for tags that match a particular pattern. The command finds the most recent tag that is reachable from a commit.

How do you clone based on tags?

To do so, we'll use the command git clone -b <tag> --single-branch <remote_repository> . The -b option accepts a tag or a branch you want to clone. The --single-branch option indicates that just the tag supplied by option -b will be cloned to local.

How can we locate a particular git commit select one?

If you have the hash for a commit, you can use the git show command to display the changes for that single commit. The output is identical to each individual commit when using git log -p .


1 Answers

What you did is create a local branch, called v0.1.27, starting from HEAD. If you only want to have a look at the v0.1.27 tag, just remove the -b option:

git checkout v0.1.27

If you plan to make changes, you might want to create a tracking branch:

git checkout -b --tracking my_v0.1.27 v0.1.27
like image 155
amx Avatar answered Sep 19 '22 12:09

amx