Explore the essentials of branch permissions, access control, and workflow enforcement to ensure secure and efficient repository management. This quiz targets core concepts and scenarios, helping users understand branch protection, permission configuration, and best practices for collaborative coding.
Which branch permission setting effectively prevents direct pushes to the 'main' branch, allowing only pull requests to be merged after review?
Explanation: Restricting write access prevents users from pushing directly to the branch, ensuring changes are introduced only via pull requests, which can be reviewed before merging. Enabling force push would allow any user to overwrite changes, which is not secure. Allowing all changes provides no protection. Disabling read permissions would block users from viewing the branch entirely, which is not a suitable control for this scenario.
If a team wants to enforce code review before changes are merged, what is the recommended action for configuring branch permissions on the default branch?
Explanation: Requiring at least one approval enforces code review, ensuring that all changes are reviewed before integration. Making the branch read-only prevents any changes, defeating the purpose of collaborative development. Deleting the branch removes it completely, stopping all activity. Allowing force-push creates risk of overwriting history, which is not related to code review enforcement.
Which method enables setting permissions that apply to all release branches named with the pattern 'release/*'?
Explanation: Branch pattern matching allows administrators to set permission rules for multiple branches that share a common naming pattern, streamlining configuration. Editing each branch individually is inefficient and prone to errors. Merging branches does not affect permissions. Archiving the repository restricts all development but doesn't provide targeted permission controls.
If a user has both individual write permissions and belongs to a group with read-only access on a branch, what is the effective permission they will have?
Explanation: Permission hierarchies typically grant users the highest level of access they possess through either group or individual assignments. The lowest permission does not override higher individual permissions. Permissions are not completely revoked in this scenario. Group permissions do not always override individual permissions, especially when individuals are assigned broader access.
What risk is introduced if 'force push' permission is granted on a protected branch?
Explanation: Granting force push allows users to overwrite commit history, which can lead to accidental or deliberate loss of commits. Weekly automatic merges are unrelated to force push permissions. Making a branch invisible is not an effect of force push, nor does it enable read-only mode. Only the risk to commit history is introduced by force push permissions.