From gitrevisions(7)
SPECIFYING REVISIONS
:/<text>, e.g. :/fix nasty bug
A colon, followed by a slash, followed by a text, names a commit whose
commit message matches the specified regular expression. This name
returns the youngest matching commit which is reachable from any ref.
The regular expression can match any part of the commit message. To
match messages starting with a string, one can use e.g. :/^foo. The
special sequence :/! is reserved for modifiers to what is matched.
:/!-foo performs a negative match, while :/!!foo matches a literal !
character, followed by foo. Any other sequence beginning with :/! is
reserved for now.
This is the same revision that is returned by
git log --grep '<regex>' -1
Where it seems awesome is in combination with git revert
or git commit --fixup
I could see running this in a panic:
git revert --no-edit ':/that thing that broke'
git commit
git push origin HEAD:refs/for/master
Found via a comment on hackernews
Add a comment (Comment Policy)