This just saved my butt.
Say you want to delete a branch:
% git branch -D s-588-test-list-of-urls
BUT THEN YOUR REALIZE YOU DELETED THE WRONG ONE. And you had commits that were local and were not pushed to the main repository, this piece of information is very helpful.
Do a:
% git reflog
And you’ll get something like:
fbfdcea HEAD@{0}: checkout: moving from master to s-588-test-list-of-urls fbfdcea HEAD@{1}: checkout: moving from b-702-slideshow-play-button-jquery to ma c87935e HEAD@{2}: checkout: moving from s-588-test-list-of-urls to b-702-slidesh eaeb971 HEAD@{3}: commit: Writing some looping code to pull urls from sitemap.xm fe2d942 HEAD@{4}: commit: adding backgroundrb fbfdcea HEAD@{5}: checkout: moving from master to s-588-test-list-of-urls fbfdcea HEAD@{6}: checkout: moving from b-702-slideshow-play-button-jquery to ma c87935e HEAD@{7}: commit: Change how the text buttons are colored 1d233b8 HEAD@{8}: checkout: moving from master to b-702-slideshow-play-button-jq fbfdcea HEAD@{9}: checkout: moving from b-702-slideshow-play-button-jquery to ma 1d233b8 HEAD@{10}: commit: Slideshows work again with jQuery f101f15 HEAD@{11}: checkout: moving from 0.8.0 to b-702-slideshow-play-button-jq 87a1769 HEAD@{12}: checkout: moving from b-702-slideshow-play-button-jquery to 0 f101f15 HEAD@{13}: commit: Playing with javascripts and styles
Pick out which revision you last remember you did on your branch and then do this (with a new branch):
% git checkout -b s-588-test-list-of-urls-redo HEAD@{3}
And then checkout the correct repository again:
% git checkout s-588-test-list-of-urls
And do a merge!
% git merge s-588-test-list-of-urls-redo
And breathe a sigh of relief because you saved yourself a panic attack.