So I was working, and I accidentally dropped one commit too many.
Oh dear.
So I thought, would there be a possibility of getting this one back? And I was quite surprised that there was.
A quick google search later, I found the information I put in the References below.
The reflog or "Reference logs" contain a record when the tips of branches or other references were updated in the local repository. From my imperfect knowledge, it sounds like a database transaction log.
With it you can pinpoint the exact point in the records where your change/branche/commit was still there and reset the head "hard" to this SHA value.
Bear in mind that the reflog is only available locally in your git repo, and it will get cleaned of old reflog entries in due time.
References
- Rewind Blog - How to Restore a Deleted Branch or Commit with Git Reflog
- https://rewind.com/blog/how-to-restore-deleted-branch-commit-git-reflog/
- git - git-reflog - Manage reflog information
- https://git-scm.com/docs/git-reflog