Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

check if pushed tag is on the git remote

Tags:

git

Anyone know how to check if a tag is on the git remote after the tag is pushed from the local?

It seems that the only way to do it is to fetch the remote.

like image 418
lcb Avatar asked Jun 09 '11 14:06

lcb


People also ask

How do I see remote tags in git?

In order to list remote Git tags, you have to use the “git ls-remote” command with the “–tags” option and the name of your remote repository.

Does git push send tags to remote?

Sharing TagsBy default, the git push command doesn't transfer tags to remote servers. You will have to explicitly push tags to a shared server after you have created them. This process is just like sharing remote branches — you can run git push origin <tagname> .

Are tags pushed with git push?

Sharing tags is similar to pushing branches. By default, git push will not push tags. Tags have to be explicitly passed to git push .

How do I push a tag to a remote repository?

Push all git tags to remote And if you want to push all tags from your local to the remote then add "--tags" to the git command and it will push all tags to the remote.


3 Answers

Try

git ls-remote --tags origin 
like image 66
Abe Voelker Avatar answered Oct 25 '22 04:10

Abe Voelker


To more precisely answer this question, to check if a specific tag is in a given remote use:

git ls-remote <remote-name> refs/tags/<tag-name>
like image 23
Diego Avatar answered Oct 25 '22 05:10

Diego


For lazy people like me, I used to search for it like this:

On remote tags:

git ls-remote --tags origin | grep TAG_NAME

On local tags.

git tag -l  | grep TAG_NAME
like image 22
HMagdy Avatar answered Oct 25 '22 06:10

HMagdy