The Hook (The "Byte-Sized" Intro)
You create a tag. You push your commits. You check the remote. The tag isn't there. That's because tags don't push automatically with git push. They live in a separate namespace and require explicit pushing. This surprises almost every beginner — and even some experienced developers who wonder why their CI didn't trigger.
📖 What is Pushing Tags?
By default, git push only pushes commits and branch refs. Tags must be pushed separately using git push origin <tag> or git push --tags.
Conceptual Clarity
Push commands:
| Goal | Command | Scope |
|---|---|---|
| Push one tag | git push origin v1.0.0 | Single tag |
| Push all tags | git push --tags | All local tags |
| Push only annotated tags | git push --follow-tags | Annotated only |
| Push commits + tags together | git push && git push --tags | Everything |
Why tags don't auto-push: Tags are often local bookmarks (lightweight tags for personal use). Auto-pushing all tags would pollute the remote with personal labels. Git requires explicit intent.
Real-Life Analogy
git push is like mailing a package. Tags are like labels on the package — but Git's post office doesn't forward labels automatically. You have to specifically ask them to send the labels along.
Visual Architecture
Why It Matters
- CI/CD triggers: Most pipelines trigger on tag push events — no push = no deployment.
- Team visibility: Tags on the remote are visible to all team members.
- GitHub Releases: GitHub creates release entries from pushed tags.
- Gotcha prevention: Knowing tags don't auto-push prevents "why didn't CI deploy?" moments.
Code
# ─── Push a specific tag ───
git push origin v1.0.0
# Only v1.0.0 goes to the remote
# ─── Push ALL tags ───
git push --tags
# ⚠️ Pushes lightweight AND annotated — may push junk tags
# ─── Push only annotated tags (safest) ───
git push --follow-tags
# Only pushes annotated tags that are reachable from pushed commits
# ─── Make --follow-tags the default ───
git config --global push.followTags true
# Now every git push also pushes annotated tags automatically!
# ─── Verify tags on remote ───
git ls-remote --tags origin
# Lists all tags on the remote
# ─── Push commits and tags together ───
git push origin main --follow-tagsKey Takeaways
- Tags do not push automatically with
git push— you must push them explicitly. - Use
git push origin <tag>for a single tag,--tagsfor all,--follow-tagsfor annotated only. - Set
push.followTags trueglobally to auto-push annotated tags with every push. - CI/CD pipelines often trigger on tag push events.
Interview Prep
-
Q: Why don't tags push automatically with
git push? A: To prevent polluting the remote with personal bookmarks. Tags live in a separate namespace and require explicit intent to share. This keeps the remote clean and gives developers control over what's published. -
Q: What is the difference between
--tagsand--follow-tags? A:--tagspushes ALL local tags (both lightweight and annotated).--follow-tagsonly pushes annotated tags that are reachable from pushed commits.--follow-tagsis safer and more intentional. -
Q: How do you configure Git to always push annotated tags? A:
git config --global push.followTags true. This makes everygit pushautomatically include reachable annotated tags, so you never forget to push release tags.