Skip to main content

Why are tags considered immutable?

Tags in Git are considered immutable because they must always point to the same state of the code and serve as a reliable fixed point for a version or a release.

In simpler terms: a tag is a "fixed version", not a working pointer.


What "immutable" means in practice

When people say a tag is immutable, they mean:

  • a tag should not "move" to another commit
  • the tag's value does not change over time
  • v1.2.0 always points to the same commit

This rule is a convention, not a strict technical restriction.


Technically: can a tag be changed?

Yes, technically it can:

  • delete the tag
  • recreate it with the same name but on a different commit

But this: breaks history confuses CI/CD makes releases untrustworthy

That is why it is considered bad practice.


Why this matters for versions and releases

1. Reliability of versions

If a tag changes:

  • the v1.0.0 version today and tomorrow may mean different code
  • it becomes impossible to reproduce a bug or a build

2. Stability of CI/CD

Very often:

  • deployment to production is triggered by a tag
  • the tag equals the version

If the tag moved:

  • you could deploy different code under the same version number

3. Audit and rollbacks

  • a tag makes it easy to find what was shipped
  • you can go back to an older version
  • history stays honest

4. Difference from branches

  • a branch is a "live pointer"
  • a tag is a historical marker

Changing historical markers is a bad idea.


Phrasing for an interview

Tags are considered immutable because they fix a specific version or release and must always point to the same state of the code. Changing a tag breaks reproducibility and automation.

Short Answer

Interview ready
Premium

A concise answer to help you respond confidently on this topic during an interview.

Why are tags considered immutable?: Git Interview Question