Created
June 28, 2016 07:12
-
-
Save 0livier/61656cb3a6b99f47e49469bdc31fb20c to your computer and use it in GitHub Desktop.
Git grep in all merges/commits into the current branch since a specif data
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
#!/usr/bin/env bash | |
if [ $# -eq 0 ] | |
then | |
self=$(basename $0) | |
echo "Usage: $self pattern directory" | |
exit 1 | |
fi | |
pattern=$1 | |
since="--since=2015-12-01" | |
for revision in `git --no-pager log $since --first-parent --format="%H"` | |
do | |
timestamp=`git --no-pager log --format='%at' -n 1 $revision` | |
count=`git --no-pager grep --extended-regexp $pattern $revision | wc -l | tr -d '[[:space:]]'` | |
echo $revision,$timestamp,$count | |
done |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment