Skip to content

Instantly share code, notes, and snippets.

@evolve2k
Created August 16, 2012 07:16
Show Gist options
  • Save evolve2k/3367641 to your computer and use it in GitHub Desktop.
Save evolve2k/3367641 to your computer and use it in GitHub Desktop.
Recovering from a Git DISASTER!!!!!!!!!!!!!!!
$ git reflog
5ee192a HEAD@{0}: checkout: moving from master to 5ee192a62f39323c61a3b2527bbda1b6fbd669c8
63322f5 HEAD@{1}: merge suite_spike_1: Fast-forward
58c63d4 HEAD@{2}: checkout: moving from suite_spike_1 to master
63322f5 HEAD@{3}: merge master: Merge made by the 'ours' strategy.
713e4ae HEAD@{4}: commit: Update ProductSuite with website, discount text and omnium code
ef7eb28 HEAD@{5}: checkout: moving from master to suite_spike_1
58c63d4 HEAD@{6}: checkout: moving from suite_spike_1 to master
(copy the head part for the commit I want to restore to)
$ git checkout -b hope HEAD@{4}
..new branch hope is now back and visible in your repo, set about licking your wounds..
More help:
http://gitready.com/advanced/2009/01/17/restoring-lost-commits.html
http://www.programblings.com/2008/06/07/the-illustrated-guide-to-recovering-lost-commits-with-git/
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment