Creating a pull request rule on GitHub that prevents me to accidentally push new code to main branch

Viewed 9

I am working on a repo where I am the owner and only author in it.

I want to have in my repo the same behavior as I would when working with a team that protects my branch from direct commits as they must go through a Pull Request. The reason for doing so is to protect from my own mistakes as I sometimes go back to main branch and accidentally push code to it. I want only code that passed through a Pull Request to be able to be merged to main branch.

In order to achieve such behavior I added the following rule to my main branch -

enter image description here

Which is almost what I need, expect that I am locked without the ability to approve my PR's as there is a message I get saying authors of the PR can't approve their PR's - a logical error nonetheless, but if I am working alone in the repo this is not what I am looking for.

How can I achieve what I am looking for?

0 Answers
Related