Created
March 9, 2016 21:26
-
-
Save OneOfOne/8bf446750d24ea084144 to your computer and use it in GitHub Desktop.
git push-new: pushes a new branch to remote and creates a pull request (uses 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/sh | |
| BRANCH=$(git symbolic-ref --short HEAD) | |
| if echo $BRANCH | grep -q master; then | |
| echo no master pushing | |
| exit 1 | |
| fi | |
| if git remote show -n origin | grep -q $BRANCH; then | |
| git push "$@" | |
| else | |
| echo creating new branch | |
| git push --set-upstream origin $BRANCH "$@" | |
| fi | |
| hub pull-request -o |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment