Last active
July 19, 2016 09:11
-
-
Save jtwalters/c6aeff437fa0c56ff355 to your computer and use it in GitHub Desktop.
Grep multiple words in your git commit message history
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# 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