Skip to contentSkip to conversation

How can I tell if a tag has been pushed, or not?

DISCUSSION layer 3 participants 4 messages Jun 15, 2016

lore
Share & tools
lore

layer

author
#0 lore raw

Here's the problem:

I expect that users, in their own private repos, will from time to time create tags that should not be pushed. Sometimes, tags that should be pushed will be created.

I could require that the "public" tags follow a specific convention (start with "release", or something). Then, the scripts all my developers use could use that and push only certain tags. However, over time there could be a large number of them. It seems undesirable to push each tag each time a push is done. So, how can I tell if a tag has already been pushed? Is there a way?

Thanks.

#1 lore raw
Quoted 6 lines · layer

Here's the problem:

I expect that users, in their own private repos, will from time to time create tags that should not be pushed. Sometimes, tags that should be pushed will be created.

Quoted 7 lines

I could require that the "public" tags follow a specific convention (start with "release", or something). Then, the scripts all my developers use could use that and push only certain tags. However, over time there could be a large number of them. It seems undesirable to push each tag each time a push is done. So, how can I tell if a tag has already been pushed? Is there a way?

At $dayjob we only allow annotated tags to be pushed. The default update hook works like a charm for that. All private tags are kept un-annotated and can therefore never be pushed by accident.

/Andreas

#2 lore raw
In reply to layer
Quoted 6 lines · layer

Here's the problem:

I expect that users, in their own private repos, will from time to time create tags that should not be pushed.  Sometimes, tags that should be pushed will be created.

Quoted 6 lines

I could require that the "public" tags follow a specific convention (start with "release", or something).  Then, the scripts all my developers use could use that and push only certain tags.  However, over time there could be a large number of them.  It seems undesirable to push each tag each time a push is done.  So, how can I tell if a tag has already been pushed?  Is there a way?

git push does not push any tags by default. You either have to specify them explicitly or add --tags (all tags). Maybe that is enough?

Otherwise, there is always git ls-remote 'tags/*'...

author
#3 lore raw
Quoted 14 lines · Alex Riesen
Quoted 14 lines · layer
Quoted 12 lines

Here's the problem:

I expect that users, in their own private repos, will from time to time create tags that should not be pushed.  Sometimes, tags that should be pushed will be created.

I could require that the "public" tags follow a specific convention (start with "release", or something).  Then, the scripts all my developers use could use that and push only certain tags.  However, over time there could be a large number of them.  It seems undesirable to push each tag each time a push is done.  So, how can I tell if a tag has already been pushed?  Is there a way?

Quoted 2 lines
Quoted 2 lines

git push does not push any tags by default. You either have to specify them explicitly or add --tags (all tags). Maybe that is enough?

No, I already knew about that.

Quoted 1 line
Quoted 1 line

Otherwise, there is always git ls-remote 'tags/*'...

This is what I needed. Thanks.