Created
September 22, 2011 10:09
-
-
Save kkaefer/1234462 to your computer and use it in GitHub Desktop.
Converts an issue into a pull request. Works within one repository only and always pulls a branch into master. Requires github.user and github.token to be set.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/sh | |
BRANCH_NAME=$(git symbolic-ref -q HEAD) | |
BRANCH_NAME=${BRANCH_NAME##refs/heads/} | |
BRANCH_NAME=${BRANCH_NAME:-HEAD} | |
REPO_NAME=`git config --get-regexp remote\..+\.url | perl -p -e 's/^remote\.\w+\.url\s+git\@github.com:(.+).git/\$1/'` | |
echo "Pulling $BRANCH_NAME into master of $REPO_NAME" | |
read -p "Issue #: " GITHUB_ISSUE | |
curl -d "pull[base]=master" -d "pull[head]=$BRANCH_NAME" \ | |
-d "pull[issue]=$GITHUB_ISSUE" \ | |
-u "`git config --get github.user`/token:`git config --get github.token`" \ | |
"https://github.com/api/v2/json/pulls/$REPO_NAME" |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment