Last active
March 30, 2019 02:52
-
-
Save matthewkturner/db7cbafd5cb76f67bf1ae33485818ac1 to your computer and use it in GitHub Desktop.
open pull request
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
github_org='narvar' | |
github_repo=${PWD##*/} | |
git_branch() { | |
local git_status="$(git status 2> /dev/null)" | |
local on_branch="On branch ([^${IFS}]*)" | |
local on_commit="HEAD detached at ([^${IFS}]*)" | |
if [[ $git_status =~ $on_branch ]]; then | |
local branch=${BASH_REMATCH[1]} | |
echo "$branch" | |
elif [[ $git_status =~ $on_commit ]]; then | |
local commit=${BASH_REMATCH[1]} | |
echo "$commit" | |
fi | |
} | |
open_pull_request() { | |
open -a Google\ Chrome https://github.com/$github_org/${PWD##*/}/compare/master...$(git_branch)?w=0 | |
} | |
alias pr=open_pull_request |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment