Last active
December 21, 2018 12:44
-
-
Save hamzaPixl/aee6a452b027383f3700a83a15a39e62 to your computer and use it in GitHub Desktop.
Create pull request for your branch
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
| to_branch=$1 | |
| if [ -z $to_branch ]; then | |
| to_branch="master" # default branch is master you can easily change it | |
| fi | |
| # try the upstream branch if possible, otherwise origin will do | |
| UPSTREAM=$(git config --get remote.upstream.url) | |
| ORIGIN=$(git config --get remote.origin.url) | |
| if [ -z $UPSTREAM ]; then | |
| UPSTREAM=$ORIGIN | |
| fi | |
| organisation="hamzaPixl" | |
| repo=$(basename `git rev-parse --show-toplevel`) | |
| from_branch=$(git rev-parse --abbrev-ref HEAD) | |
| open "https://github.com/$organisation/$repo/pull/new/$organisation:$to_branch...$organisation:$from_branch" | |
| # usage | |
| # ./create-pull-request.sh -> create a pull request from your local branch to master | |
| # ./create-pull-request.sh branch -> create a pull request from your local branch to branch |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment