Created
January 8, 2014 04:04
-
-
Save haileys/8311607 to your computer and use it in GitHub Desktop.
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: git pr-for <commit>" >&2 | |
exit 1 | |
fi | |
SHA="$(git log "$1"..master --ancestry-path --merges --reverse --oneline | grep 'Merge pull request' | head -1 | cut -d' ' -f1)" | |
if [ -n "$SHA" ]; then | |
git show "$SHA" | |
fi |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment