Created
October 22, 2014 15:09
-
-
Save claudioc/e5c5786e0816fcf206eb to your computer and use it in GitHub Desktop.
Easy github pull requests (with hub)
This file contains hidden or 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/bash | |
# Get the branch | |
B=$(git rev-parse --abbrev-ref HEAD) | |
# Get the remote | |
R=$(git config branch.${B}.remote) | |
# Get the last commit message | |
M=$(git log -n1 --format=format:%s) | |
# Set the default title | |
DEF_TITLE="${M} - ${B}" | |
# Ask the issue number and to change the message | |
read -e -p "Provide the issue number: " ISSUEN | |
read -e -p "Provide a meaningful title [${DEF_TITLE}]: " TITLE | |
TITLE="${TITLE:-${DEF_TITLE}}" | |
# Display the final command (and copy it to the clipboard | |
echo | |
echo hub pull-request -m \"${ISSUEN} ${TITLE}\" -h ${R}:${B} | |
echo hub pull-request -m \"${ISSUEN} ${TITLE}\" -h ${R}:${B} | pbcopy | |
echo Copied in your clipboard. | |
echo |
Note that git config branch.${B}.remote
will only work if you have first push -u
(set the upstream of the branch)
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
No pbcopy for windows. "clip" might do the job.