When you have a Pull Request on GitHub that includes commits from another Pull Request, you will still see them after the "child" PR has been merged. Unfortunately, GitHub won't automatically update the diff (or commit list).
Here is what worked for me:
- Check out the target branch
git checkout my-target-branch
- Make sure you are up to date against origin (e.g.
git fetch
andgit status
). You should be 0 commits ahead or behind.
- Add and commit a file
touch .please-update
git add .please-update
git commit -m "Force PR update"
- Push
- Do a hard reset to the state before adding above file:
^
git reset --hard HEAD~
- Push that state again to production with a forced push:
^
git push --force origin my-target-branch
That will make GitHub update the diffs on all Pull Requests going to that branch.
Important: While this works nicely for integration branches, you probably do not want to do this for master
or other high-traffic branches.
In that case, you can do the above for your source branch (the one that's being merged into master
). Obviously, only the PR of that branch will be updated, but may just be enough.
This feels clumsy, but it seems there is no way to make GitHub do this nicely. :( If you know of a better approach, please let me know.