AZ-400 Practice Question: Design and implement a source control strategy
Which TWO approaches can you use to enforce consistent commit message formatting across your organization? (Choose two.)
⚠ Common exam trap
Candidates often confuse client-side Git hooks (which are optional and local) with server-side hooks (which enforce policy remotely), or they mistakenly believe that PR title checks or templates provide the same level of enforcement as server-side validation.
Answer choices
Why each option matters
Answer the question above first, then reveal the full breakdown to understand why each option is right or wrong.
Correct answer & explanation
✓
Use a pre-receive hook in GitHub to validate commit messages
GitHub's pre-receive hooks are server-side scripts that execute on the repository before accepting a push, allowing you to enforce commit message format validation across all contributors. Similarly, Azure Repos branch policies can include a commit message pattern check, which validates commit messages against a regex and rejects pushes with non-conforming messages. Both approaches enforce the standard on the server side, regardless of local client configurations.
Answer analysis
Option-by-option breakdown
For each option: why learners choose it and why it is or isn't the right answer here.
- ✓
Use a pre-receive hook in GitHub to validate commit messages
Why this is correct
A pre-receive hook in GitHub executes on the server for every push and can reject commits with invalid message formats before they are accepted, providing a hard enforcement point that developers cannot bypass locally. This centralizes policy and guarantees consistent commit message history across all contributions.
- ✗
Use a GitHub workflow that checks PR titles
Why it's wrong here
A GitHub workflow that validates PR titles only checks a single field on the pull request, not the commit messages themselves. It is triggered by PR events, not push events, so developers can still submit commits with inconsistent messages while the workflow passes if the title is acceptable.
- ✓
Configure a branch policy in Azure Repos to require commit message validation
Why this is correct
Configuring a branch policy in Azure Repos requires commit message validation as part of the pull request completion process; each commit in the PR must match the defined criteria before merging. This is a server-side, centralized check that is enforced on every PR merge, making it as reliable as a pre-receive hook.
- ✗
Provide a commit message template to developers
Why it's wrong here
A commit message template simply provides a suggested format when developers run `git commit`; it doesn't validate anything. Because it is a client-side aid, developers can ignore or modify it, and there is no enforcement mechanism to ensure they follow it consistently.
- ✗
Use Git hooks only on client side
Why it's wrong here
Client-side Git hooks run locally on a developer's machine and can be explicitly bypassed using flags like `--no-verify` during commits or pushes. They are not centrally managed, so they provide no guarantee that all team members will run or maintain them, making them unsuitable for enforcing consistent commit messages across a repository.
Go deeper
Related to this question
Learn chapter
Introduction to DevOps and Azure DevOps
Key term
GitHub
GitHub is a cloud-based platform for storing, tracking, and collaborating on code using Git version control.
Key term
Azure Repos
Azure Repos is a set of version control tools that allow teams to manage their source code, track changes, and collaborate on software projects using Git or Team Foundation Version Control (TFVC) within the Microsoft Azure ecosystem.
About these practice questions
One of 823 original AZ-400 practice questions on Courseiva, each with a full explanation and wrong-answer analysis — not exam dumps or protected exam content. Learn why practice questions differ from exam dumps →
JA
Written by Johnson Ajibi, MSc IT Security
Senior Network & Security Engineer · founder of Courseiva
This AZ-400 practice question is part of Courseiva's free Microsoft certification practice question bank. Courseiva provides original exam-style practice questions with explanations, topic-based practice, mock exams, readiness tracking, and study analytics to help learners prepare for the AZ-400 exam.