Git push rejection criteria when remote is protected

Viewed 39

Consider a remote branch that requires a pull request before changes can be pushed to it. Assume a team member pushes to this remote branch anyway. Under what circumstances does the team member see a message saying that the push was rejected (because the remote branch is protected), and under what circumstances does the team member gets no rejection during the push?

Note. I understand that in the latter case, the user will see a Compare & pull request button in their GitHub profile. So the fact that their push does not get rejected does not mean that the remote is updated with the local changes.

1 Answers

under what circumstances does the team member gets no rejection during the push?

From protected branches, you would need to allow specific people the permission can push to the protected branch.

Also, by default, protected branch rules do not apply to people with admin permissions to a repository.

So the fact that their push does not get rejected does not mean that the remote is updated with the local changes.

Something on the remote should be updated anyway: the user feature branch (candidate to be a PR branch, and not protected against push) should be updated.

Related