Skip to content

Instantly share code, notes, and snippets.

@slucero
Last active September 29, 2016 18:11
Show Gist options
  • Save slucero/ee0d35afb69d63f93cba373993f35bed to your computer and use it in GitHub Desktop.
Save slucero/ee0d35afb69d63f93cba373993f35bed to your computer and use it in GitHub Desktop.
Create New Github PR

Add the git-pr file into as an executable in your local PATH. For example, if ~/bin is in your PATH, then the following should work:

# Add and save script content.
vi ~/bin/git-pr
# Make the script executable.
chmod u+x ~/bin/git-pr
repo=`git remote -v | grep origin | grep push | head -n 1 | 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/$branch
@slucero
Copy link
Author

slucero commented Sep 29, 2016

All credit goes here: http://www.devthought.com/code/create-a-github-pull-request-from-the-terminal/

This is mostly the same script with some slight adjustment.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment