Protect the repository's critical path
Branch protection or repository rules can require pull requests, approvals, successful checks, signed commits or other conditions before changes reach important branches.
Protection should match risk
A small personal project may need little enforcement. A production repository should normally have stronger controls around its main or release branches.
Automation should enforce policy
Rules are most valuable when they make the safe workflow the easy workflow. Required CI checks, review requirements and restricted direct pushes reduce accidental bypasses.