Skip to content

Instantly share code, notes, and snippets.

View michallohnisky's full-sized avatar

Michal Lohniský michallohnisky

View GitHub Profile
@michallohnisky
michallohnisky / git-recover-branch.md
Created September 25, 2015 06:21 — forked from jbgo/git-recover-branch.md
How to recover a git branch you accidentally deleted

UPDATE: A better way! (August 2015)

As pointed out by @johntyree in the comments, using git reflog is easier and more reliable. Thanks for the suggestion!

 $ git reflog
1ed7510 HEAD@{1}: checkout: moving from develop to 1ed7510
3970d09 HEAD@{2}: checkout: moving from b-fix-build to develop
1ed7510 HEAD@{3}: commit: got everything working the way I want
70b3696 HEAD@{4}: commit: upgrade rails, do some refactoring