By scanning the full history across all refs, this command lets you pinpoint commits whose messages contain a specific term.
It uses the --all flag to include commits from every branch and ref, and the --grep=<searchterm> filter to show only those commits whose message matches the given keyword or pattern, where <searchterm> can be a simple word or a more complex regex.
You can add -i (or --regexp-ignore-case) to ignore letter casing, stack multiple --grep flags to match several patterns, or use --invert-grep to exclude commits containing the term; closely related variations include git log --grep=<term> for current-branch searches only, git log -S<term> to look for term changes in diffs instead of messages, or git log -G<regex> to match changes by regex.
Examples:
git log --all --grep=fixgit log --all --grep="bug fix"git log --all --grep="^feature"