How to restore a branch deleted too quickly in Git?

Having still not the automatic reflexes for applying a successful Git branching model, I cleaned up my working repository a little too fast by deleting a hot-fix branch after merging it into the master branch.

$ git branch -d hotfix-2014062501 
Deleted branch hotfix-2014062501 (was 742134c).

When I came back to the development branch I was working on before the emergency, I realised that I just forgot to merge the hot-fix into it.

As often with Git, a simple solution exists. We only need the sha1 of that branch last commit, which was conveniently displayed in the output of the deletion command above, and execute this one-liner:

$ git branch hotfix-2014062501 742134c

The branch should now be back as if nothing happened:

$ git branch -v
hotfix-2014062501        742134c some helpful comment


"Upgrade to Firefox" bannerSupport La Quadrature du Net!Soutenir FramasoftSupport the Gooseberry project, Blender Foundation's 5th Open Movie project