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

`fatal: a branch named 'feature/login' already exists`

BeginnerTroubleshootingLost Work, HEAD and History Problems
Answer

Likely causes → The branch exists locally, maybe from an earlier attempt.

Diagnose → git branch --list 'feature/*' and git log --oneline -3 feature/login.

Fix → Switch to it (git switch feature/login), pick a different name, or reset it to a fresh start: git switch -C feature/login origin/main (this discards its old pointer; check the reflog if needed).

Prevent → Use ticket IDs in branch names and delete merged branches.

All Git & GitHub questions Roadmap: Git & GitHub

More on Lost Work, HEAD and History Problems