Created
March 29, 2016 01:14
-
-
Save mknkisk/381acbb8c87f67df5e3f 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 | |
merge_commit=$(ruby -e 'print (File.readlines(ARGV[0]) & File.readlines(ARGV[1])).last' <(git rev-list --ancestry-path $1..master) <(git rev-list --first-parent $1..master)) | |
if git show $merge_commit | grep -q 'pull request' | |
then | |
pull_request_number=$(git log -1 --format=%B $merge_commit | sed -e 's/^.*#\([0-9]*\).*$/\1/' | head -1) | |
url="`hub browse -u`/pull/${pull_request_number}" | |
echo $url | |
fi | |
open $url |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment