Skip to content

Instantly share code, notes, and snippets.

@tscritch
Created October 28, 2019 23:39
Show Gist options
  • Select an option

  • Save tscritch/4a13eebae8cb9ef4862a0497071db39c to your computer and use it in GitHub Desktop.

Select an option

Save tscritch/4a13eebae8cb9ef4862a0497071db39c to your computer and use it in GitHub Desktop.
Open Github PR from Shell
// add to your ~/.bash_profile or ~/.zsh_profile to run anywhere
pr() {
github_url=`git remote -v | awk '/fetch/{print $2}' | sed -Ee 's#(git@|git://)#https://#' -e 's@com:@com/@' -e 's%\.git$%%' | awk '/github/'`
branch_name=`git symbolic-ref HEAD | cut -d'/' -f 3,4`
pr_url=$github_url"/pull/new/"$branch_name
open $pr_url
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment