Monday, November 2, 2015

GIT Log Search Source Script

#!/usr/bin/env bash
# this.is.lance.miller@gmail.com
regex="$2*$3*$4"
clear
echo "useage"
echo "$0 2 foo fab fangs"
echo "2 is the number of results"
echo  "foo fab fangs are the search terms. wildcards are placed in between them"
echo "press [Enter] to proceed"
read
echo "search string is: $regex"
for i in `git log -$1 --decorate --pretty=tformat:'%h %d %an %ar %s' --source --all -i -G $regex | cut -d" " -f1`;
do
 echo $i
 git show $i
done
exit

Use Example

searchGIT.sh 2 foo fab fangs
2 is the number of results
foo fab fangs are the search terms. wildcards are placed in between them

No comments: