Last Updated: February 25, 2016
·
678
· ktusznio

Find lost commit by commit message

After deleting its branch, I wanted to find a certain commit that was now unreachable. Couple ways to do that:

git fsck --unreachable

This will display a list of unreachable commits. If you don't regularly run "git gc" this list may be too long to search through.

git log -g --grep="foo bar"

-g will include dangling commits and --grep will search through commit messages.