Git: restore a deleted branch. (i can find a commit within that branch with `git log -p SHA`)

I deleted a branch that i want to restore.
I tried to recover it and the only thing i could find is a commit from git-log running:
git log -p 4afa3abc4218b6251dea24c910eaced6af465d11. Also – it seems that this SHA appears only on my local mac (when my colleague run this git-log command he gets an error)

I can see the changes in the output and i would like to create a brand new branch from this git log output.

How can i easily do that?

>Solution :

Just check out the commit and create the branch.

git checkout 4afa3abc4218b6251dea24c910eaced6af465d11
git branch yourbranch

Leave a Reply