Oh no, I forcefully deleted the wrong local branch in git

Have you ever done this when cleaning up your local branches?

Only to realize that this was actually your work in progress branch that wasn't pushed to a remote?

Never fear, the reflog is here.

The reflog is like an audit trail for git, it knows about all the moves you made in your local git repo.
*Short version, it's actually pretty cool - go look it up.

In the listing above you need to find where you moved away from the now non-existant branch and create a new branch at that point.

Note that when you use git branch -D it actually tells you the SHA1 of the commit you need to restore, in the above example it's (was bc5d8cd). But if you close the terminal you won't know and the HEAD@{x} will work just fine.

From: https://git-scm.com/docs/git-reflog

For example, HEAD@{2} means "where HEAD used to be two moves ago", master@{one.week.ago} means "where master used to point to one week ago in this local repository", and so on. See gitrevisions[7] for more details.

And there is my lost commit, safely put away on a new branch which I can now actually push to a remote to not loose it again.