Something went wrong. Try again.
My personal dotfiles, which might provide inspiration for you. Not fit for running directly without forking and changing. www.elliotblackburn.com
Something went wrong. Try again.
1234567891011121314151617181920212223242526272829303132#!/bin/bash# Usage: git cpr [<branch>]# Open the pull request page for <branch>, or the current branch if not# specified. Lands on the new pull request page when no PR exists yet.# The branch must already be pushed# # From @pengwynn - https://github.com/pengwynn/dotfiles/blob/98128dc91525759ca5c58252bd01b5c89015ee1d/bin/git-pr, based on script from @rtomaykoset -e
# usage messageif [ "$1" == "--help" -o "$1" == '-h' ]; then grep ^#/ "$0" | cut -c4- exitfi
remote_url=$(git config --get remote.origin.url)repo_with_owner=$(echo $remote_url | perl -pe's/(git@|https:\/\/)?github.com(:|\/)([-\.\w]+)\/([-\.\w]+)\.git/$3\/$4/')
# figure out the branchbranch=${1:-"$(git symbolic-ref HEAD | sed 's@refs/heads/@@')"}
# check that the branch exists in the origin remote firstif git rev-parse "refs/remotes/origin/$branch" 1>/dev/null 2>&1; then # escape forward slashes branch=${branch//\//\%2f}
exec open "https://github.com/$repo_with_owner/pull/$branch"else echo "error: branch '$branch' does not exist on the origin remote." 1>&2 echo " try again after pushing the branch"fi