check if pushed tag is on the git remote

Git

Git Problem Overview


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.

Git Solutions


Solution 1 - Git

Try

git ls-remote --tags origin

Solution 2 - Git

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>

Solution 3 - Git

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

Solution 4 - Git

Another way, (from "https://stackoverflow.com/questions/5549479/git-check-if-commit-xyz-in-remote-repo";)

git branch -r --contains my_tag

# ==== or with a sha1: =====
git branch -r --contains 2e29022d

This will list the remote branches that contain the tag or commit.

The output will look like:

origin/my_branch_1
origin/my_other_branch
origin/master

Attributions

All content for this solution is sourced from the original question on Stackoverflow.

The content on this page is licensed under the Attribution-ShareAlike 4.0 International (CC BY-SA 4.0) license.

Content TypeOriginal AuthorOriginal Content on Stackoverflow
QuestionlcbView Question on Stackoverflow
Solution 1 - GitAbe VoelkerView Answer on Stackoverflow
Solution 2 - GitDiegoView Answer on Stackoverflow
Solution 3 - GitHMagdyView Answer on Stackoverflow
Solution 4 - Gitdgo.aView Answer on Stackoverflow