I just deleted the wrong branch with some experimental changes I need with git branch -D branchName
.
How do I recover the branch?
If you just deleted the branch, you will see something like this in your terminal:
Deleted branch branch_name(was e562d13)
- where e562d13 is a unique ID (a.k.a. the "SHA" or "hash"), with this you can restore the deleted branch.
To restore the branch, use:
git checkout -b
for example:
git checkout -b branch_name e562d13