0
0
Gitdevops~10 mins

Branch protection rules in Git - Interactive Code Practice

Choose your learning style9 modes available
Practice - 5 Tasks
Answer the questions below
1fill in blank
easy

Complete the command to get branch protection rules for a branch in a GitHub repository.

Git
gh api repos/:owner/:repo/branches/:branch/[1]
Drag options to blanks, or click blank then click option'
Abranches
Blist
Cprotection
Drules
Attempts:
3 left
💡 Hint
Common Mistakes
Using 'list' instead of 'protection' causes an invalid API call.
Using 'branches' repeats the resource and is incorrect.
2fill in blank
medium

Complete the YAML snippet to require pull request reviews before merging.

Git
required_pull_request_reviews:
  required_[1]: 1
Drag options to blanks, or click blank then click option'
Aapproving_review_count
Breviews
Cchecks
Dstatuses
Attempts:
3 left
💡 Hint
Common Mistakes
Using 'reviews' instead of 'approving_review_count' causes the rule to not enforce approvals.
Using 'checks' or 'statuses' relates to CI, not reviews.
3fill in blank
hard

Fix the error in the branch protection rule to enforce status checks before merging.

Git
required_status_checks:
  strict: [1]
Drag options to blanks, or click blank then click option'
Afalse
Btrue
CTRUE
DFalse
Attempts:
3 left
💡 Hint
Common Mistakes
Using uppercase 'True' or 'FALSE' causes YAML parsing errors.
Using 'False' disables the strict check.
4fill in blank
hard

Fill both blanks to create a branch protection rule that requires signed commits and disallows force pushes.

Git
require_signed_commits: [1]
allow_force_pushes: [2]
Drag options to blanks, or click blank then click option'
Atrue
Bfalse
Cenabled
Ddisabled
Attempts:
3 left
💡 Hint
Common Mistakes
Using 'enabled' or 'disabled' instead of booleans causes config errors.
Setting both to true disables some protections unintentionally.
5fill in blank
hard

Fill all three blanks to define a branch protection rule that requires linear history, status checks, and no force pushes.

Git
allow_force_pushes: [1]
required_linear_history: [2]
required_status_checks:
  strict: [3]
Drag options to blanks, or click blank then click option'
Afalse
Btrue
CTrue
DFalse
Attempts:
3 left
💡 Hint
Common Mistakes
Using uppercase booleans causes YAML errors.
Allowing force pushes breaks branch protection.