Suggest an editImprove this articleRefine the answer for “How does a tag differ from a branch?”. Your changes go to moderation before they’re published.Approval requiredContentWhat you’re changing🇺🇸EN🇺🇦UAPreviewTitle (EN)Short answer (EN)**A tag and a branch in Git** differ in their role and behavior in the commit history. **Key point:** a branch is a moving pointer to the last commit and a development tool, while a tag is an immutable marker on a specific commit, used to fix a version or a release.Shown above the full answer for quick recall.Answer (EN)Image**A tag and a branch in Git differ in their role and behavior in the commit history.** In short: **a branch is a "live pointer," while a tag is a "fixed marker."** --- ## The main difference - A **branch** points to the last commit and **moves forward** with every new commit - A **tag** points to a **specific commit** and **never changes** --- ## A simple example History: ``` A---B---C---D ``` - the `main` branch → `D` - the `v1.0.0` tag → `B` If a new commit is added: ``` A---B---C---D---E ``` - `main` → `E` - `v1.0.0` → still `B` --- ## Differences by purpose ### Branch - used for **development** - combined via merge/rebase - can change and be rewritten - often lives temporarily ### Tag - used for **versions and releases** - does not participate in merges - does not change - fixes the state of the code --- ## Differences in behavior | Criterion | Branch | Tag | |---|---|---| | Moves with new commits | yes | no | | Can be committed to | yes | no | | Used for development | yes | no | | Marks a version | no | yes | | Can be deleted | yes | yes (but rarely) | --- ## Frequently asked in interviews **Can you commit to a tag?** No. Commits are made to a branch; a tag only points to a commit. **Can a tag be "moved"?** Technically, yes (delete and recreate it), but **this is bad practice** for releases. --- ## Short answer for an interview > **A branch is a moving pointer to the last commit and a development tool, while a tag is an immutable marker on a specific commit, used to fix a version or a release.**For the reviewerNote to the moderator (optional)Visible only to the moderator. Helps review go faster.