How to push all annotated tags?

Viewed 1082

How do I push all annotated tags from my local repo to the remote, without pushing lightweight tags?

I use lightweight tags locally that I don't want pushed, so git push --tags is not a solution.

I am aware of git push --follow-tags but that will only push tags that are associated with commits currently being pushed.

I need this option because my normal workflow involves pushing from time to time, but only tagging when finalizing a release, and I sometimes forget to push a tag. This problem often goes undetected for a long time and causes a bit of confusion with other developers, since we become out of sync with our tags.

Since it's complicated to list which annotated tags exist locally but not remotely, I would like to solve this problem by just pushing all local annotated tags, which will ensure that all developers' local and remote repos have the same annotated tags.

2 Answers
Related