Accidentally deleted branch, how to restore

Describe your question in as much detail as possible:
Hi, non technical person here!
I have accidentally deleted a branch from my team’s repo and feel absolutely horrible…
Is there a way for a non technical person to recover the branch within the next 4 hours, willing to read and do anything!
This is such a bad feeling, is a branch deleted permanently gone?

Thanks for taking the time to be thorough in your request, it really helps! :blush:

Hi,

please don’t create more than one topic of the same question, this won’t speed up replies. I’ve closed the duplicated topic.

In terms of deleted branches, please learn more about reflog and extract the commit SHA1 your branch was on. Then use the checkout command.

git reflog

git checkout -b <branchname> <sha1> 

Cheers,
Michael

1 Like