Skip to content

Instantly share code, notes, and snippets.

@jtwalters
Last active July 19, 2016 09:11
Show Gist options
  • Save jtwalters/c6aeff437fa0c56ff355 to your computer and use it in GitHub Desktop.
Save jtwalters/c6aeff437fa0c56ff355 to your computer and use it in GitHub Desktop.
Grep multiple words in your git commit message history
# Example use: find commit messages that contain pattern1 and pattern2
# $ git grepwords pattern1 pattern2
# Ensure we have at least one param (a pattern)
[ -n "$1" ] || { echo "usage: $0 PATTERN..." >&2; exit 1; }
pattern=""
# Append all remaining patterns
while [ -n "$1" ]; do
pattern="$pattern --grep=$1"
shift
done
# Find the patterns in the files.
echo $pattern
git log -i --all-match $pattern
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment