Skip to content

Instantly share code, notes, and snippets.

@mdigital
Forked from alex-zige/gist:6445334
Created September 5, 2013 02:29
Show Gist options
  • Save mdigital/6445350 to your computer and use it in GitHub Desktop.
Save mdigital/6445350 to your computer and use it in GitHub Desktop.
function pr () {
target_branch=$1
local repo=`git remote -v | grep -m 1 "(push)" | sed -e "s/.*github.com[:/]\(.*\)\.git.*/\1/"`
local branch=`git name-rev --name-only HEAD`
echo "... creating pull request for branch \"$branch\" in \"$repo\""
if [[ ! -z $target_branch ]]; then
open https://github.com/$repo/pull/new/$target_branch...$branch
else
open https://github.com/$repo/pull/new/$branch
fi
}
1
export -f pr
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment