Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Git tag - Checkout issue

If there are multiple tags available in a Git project, how can we check, which is the checked out tag out of all the present ones.

git tag will list all the tags, and entries will be present in .git/refs/tags

say for example: - today we did a repository sync from master repository and got tag 1 and we checkouted tag 1 and started working on it, few weeks later we synced the content and checked out new tag.

Now if I want to check the latest status, which is the current checked-out tag - how can we do this?

like image 780
user764235 Avatar asked Aug 10 '11 11:08

user764235


2 Answers

git describe tells you the most recent tag that your working copy refers to.

Excerpt from the man page:

git-describe - Show the most recent tag that is reachable from a commit

like image 136
eckes Avatar answered Sep 30 '22 12:09

eckes


Good answers here, but another, and sometimes friendlier way, is with gitk:

gitk --all

For any given commit, it will show you the nearest tags both before and after it, not to mention the graphical layout of the commit graph with tags and branches represented

like image 44
Ryan Stewart Avatar answered Sep 30 '22 14:09

Ryan Stewart