Created
January 14, 2020 22:26
-
-
Save bradtheappguy/e5be37e015ced9640efc7b53bf81dc7e to your computer and use it in GitHub Desktop.
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 | |
| set -e | |
| [ $# -eq 0 ] && { | |
| echo "Usage: $0 new_branch_name \"Your commit message\""; | |
| echo " -Stashes local changes. | |
| -Creates new branch. | |
| -Adds and commits all changes | |
| -Pushes to github and creates branch | |
| -Switches back to original branch | |
| -Deletes PR branch" | |
| exit 1; | |
| } | |
| WORKING_BRANCH=$1 | |
| MESSAGE=$2 | |
| STARTING_BRANCH=`git rev-parse --abbrev-ref HEAD` | |
| git stash | |
| git checkout -b "${WORKING_BRANCH}" | |
| git stash apply | |
| git add -A | |
| git commit -m"${MESSAGE}" | |
| git push | |
| hub pull-request -m "${MESSAGE}" | |
| git checkout "${STARTING_BRANCH}" | |
| git branch -D "${WORKING_BRANCH}" |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment