Learn Git: "git log --grep" and "git grep"
Search for commits whose message matches a pattern
# Log commits whose message matches "salt"
git log --grep "salt"
# Log commits whose message matches either
# "salt" OR "pepper"
git log --grep salt --grep pepper
# Log commits whose message matches
# "salt" AND "pepper"
git log --all-match --grep salt --grep pepper
Search for Files matching a pattern
# Search recursively for files under version control whose content matches "salt"
git grep -e salt
# Search recursively for java files under git version control whose content matches "salt"
git grep -e salt -- '*.java'
# Search recursively for files under git version control whose content matches # "salt" OR "pepper"
git grep -e salt -e pepper
# List files under git version control whose content matches # "salt" AND "pepper"
git grep -l --all-match -e salt -e pepper
Search for Files containing a String
# Search for files containing "salt"
git log -S 'salt'