Accidentally ran git branch -D feature/critical? The branch is just a ref — the commits are still in the object database.
git reflog
# Find the tip the branch had
git branch feature/critical <hash>
If the branch tip is the commit just before the most recent reset, you can also find it via:
git reflog show feature/critical@{1}
Notes:
- Local branch deletion: recoverable via reflog (≤ 30 days for unreachable).
- Remote branch deletion (
git push origin --delete): recoverable only if someone still has it locally, then they re-push.
Mitigation: enable branch protection on the remote so deletes go through a PR.