Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Git - Recover Deleted branch from local and remote

Can I get my deleted git branch back, I deleted it from local and remote repository.

like image 960
Swapnil Srivastav Avatar asked Oct 24 '25 21:10

Swapnil Srivastav


1 Answers

Run git reflog to find the sha1 of the commit that was on the top of your deleted branch, then just run git checkout -b <branch> <sha1> and you're all set.

like image 139
YoannFleuryDev Avatar answered Oct 27 '25 11:10

YoannFleuryDev



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!