Since git allows you to run scripts as if they were git commands, this will show how to create a command for creating a pull request from the terminal.
- Create a file with the following name "git-pull-request", we can put it inside ~/.git/extensions for instance. Add the following content to the file
#!/usr/local/bin/bash
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/$branch