Last active
August 22, 2017 09:25
-
-
Save antfroger/42a6bbe278e47ffe144c7a48eb2ea726 to your computer and use it in GitHub Desktop.
Git grep in all merges/commits into the current branch since a specific date
This file contains hidden or 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 --grep="Merge pull request" --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