Lesson Completion
Back to course

Pushing Tags

Beginner
7 minutes4.7Git

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:

GoalCommandScope
Push one taggit push origin v1.0.0Single tag
Push all tagsgit push --tagsAll local tags
Push only annotated tagsgit push --follow-tagsAnnotated only
Push commits + tags togethergit push && git push --tagsEverything

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

flowchart LR LOCAL["🏷️ Local Tags<br/>v1.0.0, v1.1.0"] -->|"git push origin v1.0.0"| REMOTE["☁️ Remote Tags<br/>v1.0.0"] LOCAL -->|"git push --tags"| REMOTE2["☁️ Remote Tags<br/>v1.0.0, v1.1.0"] style LOCAL fill:#1a1a2e,stroke:#ffd700,color:#ffd700 style REMOTE fill:#0f3460,stroke:#53d8fb,color:#53d8fb style REMOTE2 fill:#0f3460,stroke:#53d8fb,color:#53d8fb

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

bash
# ─── 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-tags

Key Takeaways

  • Tags do not push automatically with git push — you must push them explicitly.
  • Use git push origin <tag> for a single tag, --tags for all, --follow-tags for annotated only.
  • Set push.followTags true globally 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 --tags and --follow-tags? A: --tags pushes ALL local tags (both lightweight and annotated). --follow-tags only pushes annotated tags that are reachable from pushed commits. --follow-tags is safer and more intentional.

  • Q: How do you configure Git to always push annotated tags? A: git config --global push.followTags true. This makes every git push automatically include reachable annotated tags, so you never forget to push release tags.

Topics Covered

Git TagsGit Remote

Tags

#git#tags#push#remote

Last Updated

2026-02-13