Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #!/bin/bash
- ###
- # Merge commits or branches as GitHub Pull Requests
- #
- # Usage: ./merge-pr.sh COMMIT PRNUMBER BRANCHNAME
- #
- # COMMIT: Commit or branch name to merge
- # PRNUMBER: Number of the pull request being merged (used in commit message)
- # BRANCHNAME: Branch name being merged (used in commit message)
- ###
- PR=$1
- BRANCH=$2
- COMMIT=$3
- if [ -z "$COMMIT" ] || [ -z "$PR" ] || [ -z "$BRANCH" ]; then
- echo "usage: ./merge-pr.sh COMMIT PRNUMBER BRANCHNAME"
- exit 1
- fi
- MESSAGE="Merge pull request #$PR from Codeminer42/$BRANCH"
- COMMAND=( git merge --no-ff --strategy-option theirs -m "'$MESSAGE'" "$COMMIT" )
- #run command
- "${COMMAND[@]}"
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement