Skip to content

Instantly share code, notes, and snippets.

@alexeypegov
Created October 16, 2013 16:46
Show Gist options
  • Save alexeypegov/7010987 to your computer and use it in GitHub Desktop.
Save alexeypegov/7010987 to your computer and use it in GitHub Desktop.
Quick Github Pull Request for current branch. Place this script somewhere in PATH and call it like "git pr"
#!/bin/sh
function pr() {
local repo=`git remote -v | grep -m 1 "(push)" | sed -e "s/.*github.com[:/]\(.*\)\.git.*/\1/"`
if [ -n "$repo" ]; then
local branch=`git name-rev --name-only HEAD`
echo "... creating pull request for branch \"$branch\" in \"$repo\""
open https://github.com/$repo/pull/new/$branch
fi
}
pr
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment