Created
February 8, 2022 02:58
-
-
Save scottsauber/74a18049f3df9e7778113b8c052b27a1 to your computer and use it in GitHub Desktop.
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
# create new PR and open it | |
function 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`; | |
main_branch=`git symbolic-ref refs/remotes/origin/HEAD | cut -d'/' -f4` | |
open_or_start='open' | |
uname=$(uname) | |
if [[ "$uname" == CYGWIN* || "$uname" == MINGW* ]] ; then | |
open_or_start='start' | |
fi | |
pr_url=$github_url"/compare/$main_branch..."$branch_name | |
$open_or_start $pr_url | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment