Last active
September 23, 2019 10:51
-
-
Save 1stvamp/1288927 to your computer and use it in GitHub Desktop.
Shortcut script to open a pull-request on Github from a local git repo
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 bash | |
if [[ $(uname -s) == "Linux" ]]; then | |
browse="xdg-open" | |
else | |
browse="open" | |
fi | |
repo=$(git remote show -n origin 2>/dev/null|sed -e "/Push URL:*/!d; s/.*[email protected]:\(.*\).git/\1/; q") | |
branch=$(git branch --no-color 2>/dev/null|sed -e '/^[^*]/d' -e 's/* \(.*\)/\1/') | |
eval "${browse} 'https://github.com/${repo}/pull/new/${branch}' &>/dev/null" |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment