Search your git commits and auto-show matches
Looking for a specific piece of code in your git commit history?
The following alias searches through all git commits for diffs containing the specified search string and opens them one-by-one in a pager:
git-search () {
git log --all -S"$@" --pretty=format:%H | map git show
}
It starts with the first matching commit (the most recent match). To open the next match, simply close the pager with q
. To abort, just use Ctrl+C
.
This uses the map
function, defined in a previous protip.
Written by Vincent Driessen
Related protips
Have a fresh tip? Share with Coderwall community!
Post
Post a tip
Best
#Shell scripting
Authors

juliomistral
25.98K

jseb
1.003K
Sponsored by #native_company# — Learn More
#native_title#
#native_desc#