Skip to content

Instantly share code, notes, and snippets.

@ijse
Created October 15, 2016 10:33
Show Gist options
  • Save ijse/bd768d1c71e1f6056afd8c9ae9bf8b5a to your computer and use it in GitHub Desktop.
Save ijse/bd768d1c71e1f6056afd8c9ae9bf8b5a to your computer and use it in GitHub Desktop.
call github api to merge branches
#!/bin/bash
# Merge Github branch
#
# Usage:
# shells/merge-branch.sh <base-branch> <head-branch> [commit message]
request=$( cd "$(dirname "${BASH_SOURCE}")" ; pwd -P )/request.sh
# The name of the base branch that the head will be merged into.
base=$1
# The head to merge. This can be a branch name or a commit SHA1.
head=$2
# Commit message to use for the merge commit. If omitted, a default message will be used.
message=$3
payload="{\"base\":\"$base\",\"head\":\"$head\",\"commit_message\":\"$message\"}"
echo "Call merge branch: $payload"
$request \
POST \
merges \
$payload
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment