/usr/bin/git-pull-request is in git-extras 1.9.1-2.
This file is owned by root:root, with mode 0o755.
The actual contents of the file can be viewed below.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 | #!/usr/bin/env bash
#
# Echo <msg> and exit
#
abort() {
echo $@
exit 1
}
#
# Produce json with <title>, <body>, and <head>
#
json() {
cat <<EOF
{
"title": "$1",
"body": "$2",
"head": "$3",
"base": "master"
}
EOF
}
# user
user=$(git config --global user.email)
test -z "$user" && abort "git config user.email required"
# branch
branch=${1-$(git symbolic-ref HEAD | sed 's/refs\/heads\///')}
# make sure it's pushed
git push origin $branch || abort "failed to push $branch"
# lame hack to get project
project=$(git config remote.origin.url | sed 's/^.*://' | sed 's/\.git$//')
# prompt
echo
echo " create pull-request for $project '$branch'"
echo
printf " title: " && read title
printf " body: " && read body
echo
# create pull request
body=$(json "$title" "$body" $branch)
curl -u "$user" "https://api.github.com/repos/$project/pulls" -d "$body"
|