Git Tips Slides
PageUp x2: previous · PageDown x2: next · Home: index

Undelete a branch

Imagine you accidentally deleted a branch:

❯ git branch -D foo-branch
Deleted branch foo-branch (was d885d38).

Oh my god! What have I done?

Relax, you can easily create the branch again.

❯ git switch --detach d885d38
❯ git switch -c foo-branch