Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
git + hub command to send a PR w/ auto-created branch
#! /bin/sh
## Place me on the PATH, as `git-send-github-pr`, and then `git send-github-pr HEAD^1`.
## The script will create a new branch, send the PR, then go back to wherever you were.
##
## (C) 2018 Gergely Nagy, released under the MIT license.
LAST_PR_ID="$(git branch --list 'github-pr/*' | cut -d/ -f2- | sort -n | tail -n 1)"
N="$(expr ${LAST_PR_ID} + 1)"
hub checkout -b "github-pr/${N}" ${1}
hub pull-request -p
hub checkout -
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.