Skip to content

Instantly share code, notes, and snippets.

@knoopx
Last active December 19, 2015 22:58
Show Gist options
  • Save knoopx/6030974 to your computer and use it in GitHub Desktop.
Save knoopx/6030974 to your computer and use it in GitHub Desktop.
Send github pull requests from the command line

Requirements:

Usage:

git co -b my-branch
git commit -a "My commit"
git push origin my-branch
git pull-req # sends a pull-req from origin/my-branch into origin/master
#!/usr/bin/env bash
function __github_current_branch {
echo "$1`git branch --no-color 2> /dev/null | sed -e '/^[^*]/d' -e 's/* \(.*\)/\1/'`"
}
function __github_remote_origin {
echo "$1`git remote -v | grep "(push)" | sed "s#origin.*:\([^/]*\).*push.*#\1#"`"
}
git fetch origin && hub pull-request -h $(__github_remote_origin):$(__github_current_branch)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment