Created
February 12, 2016 01:46
-
-
Save tamird/e005c6a0a6248d66594b to your computer and use it in GitHub Desktop.
This file contains hidden or 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
#!/usr/bin/env sh | |
set -eu | |
if [ $# == 0 ]; then | |
branch_name=$(git rev-parse --abbrev-ref HEAD) | |
remote_name=$(git config branch."$branch_name".remote) | |
github_forked_org_name=$(git config remote."$remote_name".url | sed -E -e 's,^(https://|git@)github.com[:/]([a-z]+)/[a-z]+(\.git)?,\2,') | |
github_origin_proj_url=$(git config remote.origin.url | sed -E -e 's,^(https://|git@)github.com[:/]([a-z]+/[a-z]+)(\.git)?,\2,') | |
url="https://github.com/$github_origin_proj_url/compare/master...$github_forked_org_name:$branch_name?expand=1#files_bucket" | |
open "$url" | |
else | |
hub fetch origin refs/pull/"$1"/head:pr/"$1" && hub checkout pr/"$1" | |
fi |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment