What is git tag?

Why Interviewers Ask This

This question tests conceptual clarity. Interviewers want to hear a precise, confident definition before moving to more complex Git & GitHub topics. It also reveals how well you can explain technical ideas to non-experts.

Answer

Tags are named references to specific commits, typically used to mark release versions. Unlike branches, tags don't move — they always point to the same commit. Two types: (1) Lightweight tag: git tag v1.0 — just a pointer to a commit, no extra metadata. Like a branch that doesn't move; (2) Annotated tag: git tag -a v1.0 -m "Version 1.0 release" — stored as a full Git object with author, date, message, and optional GPG signature. Recommended for releases. Tag a specific commit: git tag v1.0-fix abc1234. List tags: git tag or git tag -l "v1.*" (wildcard filter). Show tag info: git show v1.0. Push tags to remote: git push origin v1.0 (single tag) or git push --tags (all tags). Push with commit: git push origin main --follow-tags (only annotated tags). Delete local tag: git tag -d v1.0. Delete remote tag: git push origin --delete v1.0. Checkout a tag: git checkout v1.0 — creates detached HEAD. For production deployment: git checkout -b hotfix v1.0.

Common Mistake

Candidates often give textbook answers here. Interviewers are more impressed when you relate the concept to a specific problem you solved in a real Git & GitHub project.