Last active
August 29, 2015 14:15
-
-
Save imesh/4cc0d0e7020a61f0fa3b to your computer and use it in GitHub Desktop.
Merge Stratos Pull Requests
This file contains 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 | |
# Clone stratos git repository and add github mirror as a remote | |
# git clone https://git-wip-us.apache.org/repos/asf/stratos.git | |
# git remote add github https://github.com/apache/stratos.git | |
set -e | |
pr_no=$1 | |
pr_branch=pr_${pr_no} | |
dest_branch="master" | |
echo "Trying to apply pull request: ${pr_no}" | |
pushd stratos | |
echo "Pulling latest changes..." | |
git checkout ${dest_branch} | |
git pull --rebase | |
echo "Fetching the pull request..." | |
git fetch github pull/${pr_no}/head:${pr_branch} | |
echo "Checking out ${dest_branch} branch..." | |
git checkout ${dest_branch} | |
echo "Rebasing ${pr_branch} on ${dest_branch}..." | |
git rebase -i ${pr_branch} | |
git pull --rebase | |
git commit --allow-empty -m "This closes #${pr_no} on GitHub" | |
git push origin ${dest_branch} | |
popd | |
echo "Successfully merged pull request: ${pr_no}" |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment