Interview Prep/DevOps Fundamentals/Branching, versioning & releases

What is a Git tag, and how are tags used in releases?

BeginnerConceptBranching, versioning & releases
Answer

In one line: A Git tag is a permanent label on a specific commit — usually used to mark a release, like v1.4.0 — so you can always find, rebuild or roll back to that exact version.

Branch vs tag:

  • A branch moves forward as new commits are added.
  • A tag stays fixed on one commit forever.

Two types:

  • Lightweight tag — just a name pointing to a commit: git tag v1.4.0.
  • Annotated tag — stores the tagger, date and a message, and can be signed: git tag -a v1.4.0 -m "Release 1.4.0". Recommended for releases.

Useful commands:

git tag -a v1.4.0 -m "Release 1.4.0"   # create
git push origin v1.4.0                  # push one tag
git push origin --tags                  # push all tags
git tag -l "v1.*"                       # list
git checkout v1.4.0                     # look at the code of that release

How tags are used in CI/CD:

  1. Trigger release pipelines — pushing a v* tag builds and publishes the release.
    on:
      push:
        tags: ["v*"]
    
  2. Version artifacts — the Docker image gets the same version: orders:1.4.0.
  3. Release notes — GitHub/GitLab Releases are created from tags with changelogs.
  4. Traceability and rollback — you know exactly which code is in production and can redeploy an older tag.

Good practices:

  • Use a consistent format (v1.4.0, following SemVer).
  • Never move or reuse a release tag; make a new version instead.
  • Protect release tags so only the pipeline or release managers can create them.

Tip for interviews: mention that tags trigger release pipelines and link Git commits to artifact versions.

All DevOps Fundamentals questions

More on Branching, versioning & releases