Skip to content

Instantly share code, notes, and snippets.

@cwaring
Created December 12, 2013 16:06
Show Gist options
  • Save cwaring/7930464 to your computer and use it in GitHub Desktop.
Save cwaring/7930464 to your computer and use it in GitHub Desktop.
Simple command line tool to open up a pull request (into the dev branch) from your current local branch.
#!/bin/bash
open=$(which xdg-open 2> /dev/null)
if [[ ! $open ]]; then
open='open'
fi
repo=$(git remote -v | grep -m 1 "(push)" | sed -e "s/.*github.com[:/]\(.*\)\.git.*/\1/")
branch=$(git name-rev --name-only HEAD)
echo "... creating pull request for branch \"$branch\" in \"$repo\""
$open "https://github.com/$repo/compare/dev...$branch?expand=1"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment