Interview Prep/Git & GitHub/Lost Work, HEAD and History Problems

After rebasing and force-pushing, the release tag `v2.1.0` is no longer on any branch.

AdvancedTroubleshootingLost Work, HEAD and History Problems
Answer

Likely causes → A tag points at a specific commit SHA. Rewriting history created new commits, so the tag still points at the old ones.

Diagnose →

git branch -a --contains v2.1.0       # empty output means orphaned
git log --oneline -1 v2.1.0
git cherry -v main v2.1.0^{}

Fix → Decide which is the truth. If the shipped artifact was built from the old commit, keep the tag and merge or cherry-pick the old line back, or document the divergence. If the tag was meant to follow the new history, re-tag only if no one has consumed it. Otherwise cut v2.1.1.

Prevent → Never rewrite history that carries tags, and protect main and release branches from force pushes.

All Git & GitHub questions Roadmap: Git & GitHub

More on Lost Work, HEAD and History Problems