- #1
- 2,138
- 2,713
Suppose, for a certain a repo, I create a branch protection rule for the
As a consequence of the above, all the three merge options in GitHub are practically unavailable.
The following situations will now arise when I am trying to merge a branch that I have created:
I know I can checkout PRs locally. Can I somehow merge them locally and then push to main (which will close the PR automatically as merged)?
It seems that merging someone else's PR with the above branch rules enforced is nearly impossible. Am I right in this conclusion?
If yes, and if I relax the linear history rule but ensure that before merging, the fork/branch is rebased with
What are your opinions on this?
main
branch with the following:- Require pull request before merging. This means that each feature or bugfix must be on separate branches, which will be later merged with
main
. - Maintain linear history of the
main
branch, which implies that simple merges on GitHub are disabled. - Ensure all commits to be signed, and reject unsigned commits. This means that
Rebase and merge
in GitHub will fail, as GitHub cannot automatically sign such commits.
main
, unless the commit history is awfully created. Therefore, I hope to avoid using Squash and merge
.As a consequence of the above, all the three merge options in GitHub are practically unavailable.
The following situations will now arise when I am trying to merge a branch that I have created:
- I push the branch to the remote, with all the commits, and create a pull request. I may add more commits after creating a PR.
- I locally rebase this branch with
main
and force-push to remote, if necessary. - Since all the three merge options for a PR are practically unavailable, I merge the branch into
main
locally and push to remote. This will close the PR and delete the remote branch automatically. Thereafter, I can also delete the local branch. Linear history will be preserved.
main
? I don't have any merge option at all!I know I can checkout PRs locally. Can I somehow merge them locally and then push to main (which will close the PR automatically as merged)?
It seems that merging someone else's PR with the above branch rules enforced is nearly impossible. Am I right in this conclusion?
If yes, and if I relax the linear history rule but ensure that before merging, the fork/branch is rebased with
main
, then I will end up with a nearly clean history, somewhat as follows:
Code:
main
|
|
|
* <---------- The PR merge commit on GitHub
|\
| \
| \
| * ---
| | |
| | |
| * |
| | |
| | |
| * |------> The fork that is to be merged, rebased with main
| | |
| | |
| * |
| | |
| | |
| * ---
| /
| /
|/
*
|
|
*
|
|
*
|
|
What are your opinions on this?