Courseiva
Question 52 of 823
Design and implement a source control strategyhardMultiple SelectObjective-mapped

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.

About these practice questions

Courseiva creates original exam-style practice questions with explanations and wrong-answer analysis. It does not publish real exam questions, exam dumps, or protected exam content. Learn why practice questions differ from exam dumps →

How Courseiva writes practice questions · Editorial policy

Last reviewed: Jun 25, 2026

Question Discussion

Share a tip, memory trick, or ask about the reasoning behind this question. Do not post real exam questions, leaked content, braindumps, or copyrighted exam material. Comments are moderated and may be removed without notice.

Loading comments…

Sign in to join the discussion.

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.