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 |
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.