Created
April 11, 2014 19:36
-
-
Save lucaswerkmeister/10495164 to your computer and use it in GitHub Desktop.
Script to find mentions of git commit hashes in commit messages or diffs
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
( | |
commits=($(git log --pretty='format:%h' -S'\b[a-f0-9]{7,}\b' --pickaxe-{all,regex})); | |
commits+=($(git log --pretty='format:%h' --grep='\b[a-f0-9]\{7,\}\b')); | |
for commit in ${commits[*]}; do | |
for shaish in $(git show $commit | tail -n+5 | grep -v '^index' | grep -oe '[a-f0-9]\{7,\}'); do | |
if git rev-list HEAD.."$shaish" &> /dev/null; then | |
echo $shaish; | |
fi | |
done | |
done | |
) | sort | uniq |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment