Interview Q&A / Git & GitHub

IntermediateQuick answer1 min readUpdated 3 Oct 2026

How do you work from an old tag, and can you move or delete a tag?

SHORT ANSWER

Checking out a tag puts you in detached HEAD, so create a branch from it with git switch -c fix v1.0. You can delete a tag with git tag -d, but moving a published tag confuses others and should be avoided.

Explain it simply

A tag is a fixed milestone, like the 1.0 mark on a ruler. You can stand there and look around, but you should not move the mark.

For a hotfix on an old release, create a branch at the tag: git switch -c hotfix/1.0.1 v1.0. Locally you can delete (git tag -d) or force-move (git tag -f) a tag, but if it is already pushed, others keep the old target and the tag silently differs between machines. Make a new tag such as v1.0.1 instead.

Example

bash
git switch -c hotfix/1.0.1 v1.0
# ... fix, commit ...
git tag -a v1.0.1 -m "Hotfix"
git push origin hotfix/1.0.1 v1.0.1

What to say in the interview

"Checking out a tag detaches HEAD, so I branch from it for fixes. I avoid moving a pushed tag, because other clones will not update it. A fix gets a new tag such as v1.0.1."

Common mistakes

  • Force-moving a tag that teammates or CI have already used.

#git#tags#checkout

Related questions

Practise more Git & GitHub questions

Test your recall with short answers, then return to the detailed explanations when you need context.

Open Git & GitHub quick answers →

Get new questions like this by email

One short email when something new and useful lands. No spam, unsubscribe in one tap.

By subscribing you agree to the Privacy Policy.