Recover a deleted branch from the reflog
Use git reflog list to find a surviving log, inspect the deleted branch’s old tip, and restore a branch name at that commit.
You switched from filters to main and deleted filters before merging its last commit. The branch name has gone. If you made that commit while filters was checked out, your worktree's HEAD reflog can still hold its ID.
Find a reflog that survived
Run git reflog list in the worktree where you made the commit. Then open the log for HEAD.
git reflog list
git reflog show HEADAfter the deletion, the list in this example contains HEAD and refs/heads/main, and the log for HEAD still shows commit: Add status filter.
When you delete a branch, Git removes the branch's own reflog with it. The HEAD reflog records where you had the worktree checked out. Read down past the entry for switching to main. The switch entry itself points to the branch you switched to. Look for the commit entry before it.
Check the tip before recreating the name
In this example, the commit entry has the selector HEAD@{1}. Its position can change after another checkout or commit, so copy the commit hash from your listing. If you use the selector, resolve it to a hash before running commands that move HEAD.
tip=$(git rev-parse 'HEAD@{1}')
git show --stat "$tip"The output shows Add status filter and its changes to filter.txt.
Restore a branch pointer
Use the verified hash as the start point. In the same shell, create the branch and show its top commit.
git branch filters "$tip"
git log -1 --oneline filtersYou see Add status filter at the tip of filters, and your checkout stays on main.
If HEAD lacks the commit and you use several worktrees, check the worktree where you made it. Each worktree has its own HEAD log. If you still have another clone that held the branch, check its refs or reflog too. Reflog entries can expire, so save the branch pointer once you find the right commit.