Advertisement
Guest User

Untitled

a guest
Sep 1st, 2015
80
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.63 KB | None | 0 0
  1. #!/bin/bash
  2.  
  3. ###
  4. # Merge commits or branches as GitHub Pull Requests
  5. #
  6. # Usage: ./merge-pr.sh COMMIT PRNUMBER BRANCHNAME
  7. #
  8. # COMMIT: Commit or branch name to merge
  9. # PRNUMBER: Number of the pull request being merged (used in commit message)
  10. # BRANCHNAME: Branch name being merged (used in commit message)
  11. ###
  12.  
  13. PR=$1
  14. BRANCH=$2
  15. COMMIT=$3
  16.  
  17. if [ -z "$COMMIT" ] || [ -z "$PR" ] || [ -z "$BRANCH" ]; then
  18. echo "usage: ./merge-pr.sh COMMIT PRNUMBER BRANCHNAME"
  19. exit 1
  20. fi
  21.  
  22. MESSAGE="Merge pull request #$PR from Codeminer42/$BRANCH"
  23. COMMAND=( git merge --no-ff --strategy-option theirs -m "'$MESSAGE'" "$COMMIT" )
  24.  
  25. #run command
  26. "${COMMAND[@]}"
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement