lcb
lcb

Reputation: 989

check if pushed tag is on the git remote

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.

Upvotes: 83

Views: 34573

Answers (4)

HMagdy
HMagdy

Reputation: 3295

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

Upvotes: 8

Diego
Diego

Reputation: 5546

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>

Upvotes: 48

dgo.a
dgo.a

Reputation: 2764

Another way, (from "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

Upvotes: -3

Abe Voelker
Abe Voelker

Reputation: 31594

Try

git ls-remote --tags origin

Upvotes: 116

Related Questions