In order to keep a linear history, I use the following approach to merge changes instead of relying on github's merge functionality:
git checkout -b feature_x user/feature_x
git rebase master
git checkout master
git merge --no-ff feature_x
git push origin master # On Github: PR gets merged and closed
git branch -D feature_x
The above works perfectly fine but in cases when I have to manually resolve conflicts, the PR doesn't show up as merged on Github automatically and I have to manually close the PR.
Is there a better approach to merging the pull requests that automatically shows Github PRs merged and closed?
As onlythefinestwilldo has rightly pointed out, once a branch is rebased, it contains a different set of commits which means that the original pull request will not be affected.
To overcome this problem, we have changed our process: now, we do not rebase branch when merging the changes to master. If the changes can't be merged, the creator of the pull request is asked to rebase their branch and update the pull request. Though inconvenient, this is the only way to make sure that the pull requests automatically get closed when merged.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With