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 github-pr.sh script.
| Alternatively, if you are confident using git from within your IDE, consider the specific IDE setup guides Eclipse and IntelliJ. | 
The script will merge the fork into a temporary branch, and then run a build. Once you are happy, you can commit.
Process and Usage
The overall process is as follows:
- 
locate/raise corresponding JIRA ticket, eg CAUSEWAY-1162
 - 
checkout branch from which PR was forked (usually just 'main')
 - 
merge PR into temporary branch using the
github-pr.shscript - 
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.
Prerequisites
The script uses 'jq' to parse JSON. To install:
- 
on Linux:
aptitude install jq - 
on MacOS:
brew install jq - 
on Windows:
Download exe from website
 
Syntax
The syntax is:
github-pr.sh -j 1162 -g 31 [-s] [-p CAUSEWAY]
where:
- 
-j 1162is the JIRA ticket number
 - 
-g 31is the github PR issue number
 - 
-swill optionally skip the build and auto-merge
 - 
-p CAUSEWAYoptionally overrids the JIRA project (defaults to 'CAUSEWAY')
 
Example transcript
The listing below shows the steps taken by the script:
$ sh github-pr.sh causeway 1162 31
Found JIRA ticket
Found github PR
branch_name_local: main
username         : sebadiaz
repo_full_name   : sebadiaz/causeway
repo_clone_url   : https://github.com/sebadiaz/causeway.git
branch_name_fork : main
merging into: CAUSEWAY-1162_pr-31
Deleting branch 'CAUSEWAY-1162_pr-31'
Deleted branch CAUSEWAY-1162_pr-31 (was bd2e3c2).
Creating the branch CAUSEWAY-1162_pr-31
Switched to a new branch 'CAUSEWAY-1162_pr-31'
Pulling the changes from https://github.com/sebadiaz/causeway.git main
From https://github.com/sebadiaz/causeway
 * branch            main     -> FETCH_HEAD
Auto-merging core/pom.xml
Merge made by the 'recursive' strategy.
 core/pom.xml                                       |   3 +-
 .../apache/causeway/security/shiro/CausewayLdapRealm.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 main && git merge --no-ff CAUSEWAY-1162_pr-31 && git branch -d CAUSEWAY-1162_pr-31
The screenshot belows shows the history we end up with:
This shows the fork being merged into the temporary branch ("CAUSEWAY-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.