And here is how you find the remote tags:
git ls-remote --tags origin
Also git show-ref
is rather useful, so that you can directly associate tags with correspondent commits:
$ git tag
osgeolive-6.5
v8.0
...
$ git show-ref --tags
e7e66977c1f34be5627a268adb4b9b3d59700e40 refs/tags/osgeolive-6.5
8f27e65bddd7d4b8515ce620fb485fdd78fcdf89 refs/tags/v8.0
...
To see details about the latest available tag I sometimes use:
git show `git describe` --pretty=fuller
For a GUI to do this I have just found that 'gitk' supports named views. The views have several options for selecting commits. One handy one is a box for selecting "All tags". That seems to work for me to see the tags.
To list tags I prefer:
git tag -n
The -n
flag displays the first line of the annotation message along with the tag, or the first commit message line if the tag is not annotated.
You can also do git tag -n5
to show the first 5 lines of the annotation.
You can list all existing tags git tag
or you could filter the list with git tag -l 'v1.1.*'
, where *
acts as a wildcard. It will return a list of tags marked with v1.1
.
You will notice that when you call git tag
you do not get to see the contents of your annotations. To preview them you must add -n
to your command: git tag -n2
.
$ git tag -l -n2
v1.0 Release version 1.0
v1.1 Release version 1.1
The command lists all existing tags with maximum 3 lines of their tag message. By default -n
only shows the first line. For more info be sure to check this tag related article as well.
Listing the available tags in Git is straightforward. Just type git tag
(with optional -l
or --list
).
$ git tag
v5.5
v6.5
You can also search for tags that match a particular pattern.
$ git tag -l "v1.8.5*"
v1.8.5
v1.8.5-rc0
v1.8.5-rc1
v1.8.5-rc2
Getting latest tag on git repository
The command finds the most recent tag that is reachable from a commit. If the tag points to the commit, then only the tag is shown. Otherwise, it suffixes the tag name with the number of additional commits on top of the tagged object and the abbreviated object name of the most recent commit.
git describe
With --abbrev
set to 0
, the command can be used to find the closest tagname
without any suffix:
git describe --abbrev=0
Other examples:
git describe --abbrev=0 --tags # gets tag from current branch
git describe --tags `git rev-list --tags --max-count=1` // gets tags across all branches, not just the current branch
How to prune local git tags that don't exist on remote
To put it simple, if you are trying to do something like git fetch -p -t
, it will not work starting with git version 1.9.4
.
However, there is a simple workaround that still works in latest versions:
git tag -l | xargs git tag -d // remove all local tags
git fetch -t // fetch remote tags
Try to make git tag
it should be enough if not try to make git fetch
then git tag
.
If you want to check you tag name locally, you have to go to the path where you have created tag(local path). Means where you have put your objects. Then type command:
git show --name-only <tagname>
It will show all the objects under that tag name. I am working in Teradata and object means view, table etc
Source: Stackoverflow.com