Created
September 19, 2012 05:37
-
-
Save ariya/3747861 to your computer and use it in GitHub Desktop.
Find some Git commits and print out the subject and GitHub link
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
#!/bin/bash | |
if [ "$#" == "0" ]; then | |
echo "Usage: find-github-commits issue-number" | |
exit 1 | |
fi | |
repo=$(git config --get remote.origin.url | cut -d ':' -f 2 | sed 's/....$//') | |
for commit in $(git rev-list --reverse origin/master) | |
do | |
if git log --format=%B -n 1 $commit | grep --silent "\?id\=$1$"; then | |
git log --format=%s -n 1 $commit | |
echo "https://github.com/$repo/commit/$(git log --format=%H -n 1 $commit | cut -c 1-10)" | |
echo | |
fi | |
done |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment