Written by Sean Behan on Sun Jun 17th 2012

Workflow git checkout -b _new_branch_name

do some work and commit changed

git checkout master git branch -d _new_branch_name

doh... i meant to merge first

Fortunately, you can easily recover from this mistake.

git reflog
395b1ea HEAD@{0}: checkout: moving from _master_cleanup_akismet to _master_cleanup
bd7df04 HEAD@{1}: commit: spam handling using akismet for form submissions on contact_submission and applicant models
395b1ea HEAD@{2}: checkout: moving from _master_cleanup to _master_cleanup_akismet
395b1ea HEAD@{3}: commit: cleaning up and adding some basic features
a828ef3 HEAD@{4}: checkout: moving from master to _master_cleanup
Should show you a list of commits across all branches in desc chronological order.

To merge the branch you just deleted you can give merge the sha.

git merge bd7df04
Which would match the commit at HEAD@{1}

Tagged with..
#branching #commit #Git #mistakes #recovery #reflog #workflow #Git

Just finishing up brewing up some fresh ground comments...