Skip to content

Instantly share code, notes, and snippets.

@settermjd
Created February 13, 2018 10: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 settermjd/c46b8838bce61648af5d3ee277f56208 to your computer and use it in GitHub Desktop.
Save settermjd/c46b8838bce61648af5d3ee277f56208 to your computer and use it in GitHub Desktop.
#!/bin/bash
# Inspired by http://www.devthought.com/code/create-a-github-pull-request-from-the-terminal/
targetbranch=master
if test "$1"; then
targetbranch=$1
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/pull/new/$targetbranch...$branch"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment