Created
April 13, 2016 15:56
-
-
Save benwells/44ab7cd2a80278c3ac51f51936f5ea9e to your computer and use it in GitHub Desktop.
Open a Pull Request for current branch from OSX Terminal
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
# put this function in your .bash_profile or .zshrc to open the github compare screen | |
# for your current branch. Of course, you must push your branch up remotely first for this to work. | |
# The function parses your current working branch from the output of git branch | |
# and opens github in Chrome, right to the compare page for your branch. | |
# | |
# Edit myaccountname and myreponame and enter the account and repo of your choice. | |
# | |
function openpr () { | |
ACCOUNT=myaccountname # replace with your account name | |
REPO=myreponame # replace with your repo name | |
URL=`git branch 2> /dev/null | sed -e '/^[^*]/d' -e 's/* \(.*\)/github\.com\/GITHUB_ACCOUNT\/GITHUB_REPO\/compar e\/\1/'` | |
URL="${URL/GITHUB_ACCOUNT/$ACCOUNT}" | |
URL="${URL/GITHUB_REPO/$REPO}" | |
open -a /Applications/Google\ Chrome.app https://$URL | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment