Skip to content

Instantly share code, notes, and snippets.

@dariobanfi
Created July 14, 2017 09:42
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save dariobanfi/96ed2bb5ffda196c63b55cb0db6d4cfe to your computer and use it in GitHub Desktop.
Save dariobanfi/96ed2bb5ffda196c63b55cb0db6d4cfe to your computer and use it in GitHub Desktop.
OsX bash function to open pull requests for GitHub Enterprise accounts
function makepr() {
giturl='github.enterprise.url'
branch=`git rev-parse --abbrev-ref HEAD`
remote=`git remote get-url origin`
if [[ $remote == https* ]]; then
project=$(echo $remote | sed -e "s/.*$giturl\/\(.*\).git.*/\1/")
else
project=$(echo $remote | sed 's%^.*:\([^:]*\)\.git$%\1%g')
fi
open "https://$giturl/$project/compare/$branch?expand=1"
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment