Merging a Pull Request
The process for merging in github pull requests (so that they can be tested locally before committing) has been scripted in the
The script will merge the fork into a temporary branch, and then run a build. Once you are happy, you can commit.
The overall process is as follows:
locate/raise corresponding JIRA ticket, eg ISIS-1162
checkout branch from which PR was forked (usually just 'master')
merge PR into temporary branch using the
test the change locally (run the app, rebuild, manual regression tests etc)
if required, tidy up/refactor code as required
merge temporary branch into mainline, and commit
This screencast also shows the process.
The script uses 'jq' to parse JSON. To install:
aptitude install jq
brew install jq
Download exe from website
The syntax is:
github-pr.sh -j 1162 -g 31 [-s] [-p ISIS]
is the JIRA ticket number
is the github PR issue number
will optionally skip the build and auto-merge
optionally overrids the JIRA project (defaults to 'ISIS')
The listing below shows the steps taken by the script:
$ sh github-pr.sh isis 1162 31 Found JIRA ticket Found github PR branch_name_local: master username : sebadiaz repo_full_name : sebadiaz/isis repo_clone_url : https://github.com/sebadiaz/isis.git branch_name_fork : master merging into: ISIS-1162_pr-31 Deleting branch 'ISIS-1162_pr-31' Deleted branch ISIS-1162_pr-31 (was bd2e3c2). Creating the branch ISIS-1162_pr-31 Switched to a new branch 'ISIS-1162_pr-31' Pulling the changes from https://github.com/sebadiaz/isis.git master From https://github.com/sebadiaz/isis * branch master -> FETCH_HEAD Auto-merging core/pom.xml Merge made by the 'recursive' strategy. core/pom.xml | 3 +- .../apache/isis/security/shiro/IsisLdapRealm.java | 198 +++++++++++++++++++-- 2 files changed, 186 insertions(+), 15 deletions(-) Merged the PR; hit enter to build
The build now commences. Once done, the script continues:
If build successful and happy to merge, execute: git checkout master && git merge --no-ff ISIS-1162_pr-31 && git branch -d ISIS-1162_pr-31
The screenshot belows shows the history we end up with:
This shows the fork being merged into the temporary branch ("ISIS-1162_pr-31"), then some further tidy-up, and finally the merging of the temporary branch into mainline.
Note that there is no rebasing in this model. This is intentional: when the merged branch is pushed, github will automatically close the original pull request.