AZ-400 domain - 13% of the exam

Design and Implement a Source Control Strategy

Design and Implement a Source Control Strategy is 13% of the AZ-400 exam. These are the objectives it covers, each with practice questions, with every answer explained.

The domain in numbers

37
Practice questions
3
Objectives
25
Medium
12
Hard

Where people go wrong

  • Swapping what each completion merge strategy leaves on main

    The wrong answers attach the wrong commit shape to an Azure Repos completion strategy. Squash merge collapses every source-branch commit into one commit on main. Rebase and fast-forward replays each commit individually and adds no merge commit, so history stays linear. A basic merge keeps every commit and adds one merge commit marking the integration point. Semi-linear merge also adds a merge commit, so it fails a strictly linear requirement.

    See it in a sample question
  • Choosing a branching model by reputation

    The wrong answers pick a model because it is well known, not because it fits the delivery situation. GitFlow's develop and release branches suit a vendor maintaining several shipped versions on a scheduled cadence, but they lengthen divergence for a team integrating daily. Trunk-based development with short-lived branches and feature flags suits continuous delivery from one line, but gives no per-version maintenance branches. A forking workflow suits external contributors without write access and adds overhead for a trusted team.

    See it in a sample question
  • Enforcing a review rule with a build or status check

    The wrong answers reach for build validation, a custom status check or a workflow to enforce a rule about people. A build or status gate reports a pipeline or posted result. It does not count approvals, reset them after a push, stop an author's own approval counting, or track whether comment threads are resolved. Those behaviours are settings of the minimum reviewers policy in Azure Repos, or of the branch protection rule in GitHub.

    See it in a sample question
  • Expecting additive or local actions to purge history

    The wrong answers treat a new commit or a local cleanup as if it removed data from earlier commits. A revert adds a compensating commit, deleting a file changes only the latest snapshot, a gitignore or gitattributes entry applies from then on, and garbage collection prunes only unreachable objects. A leaked secret or an oversized blob stays in history until git filter-repo, or git lfs migrate import for binaries, rewrites every commit, followed by a force-push.

    See it in a sample question
  • Applying Git LFS to a slow clone that is not about binaries

    Git Large File Storage is offered as the fix for slow clones, but it only addresses large binary files. A monorepo that is slow because every working copy materialises the whole tree needs Scalar, which enables partial clone and sparse checkout, or sparse-checkout in cone mode to populate only chosen directories. A very deep commit history needs a partial clone with a blob filter, which keeps full branching, while a shallow clone truncates history and breaks that need.

    See it in a sample question

Objectives in this domain

What to study

The official documents this domain's practice questions cite most.

Sample questions from this domain

Free sampleDesign and Implement a Source Control Strategymedium

A team requires that the history of the main branch shows exactly one commit per completed pull request, with no intermediate work-in-progress commits from the feature branch, so that reverting a feature is a single-commit operation. Which pull request completion merge strategy in "Azure Repos" delivers this?

  • ARebase and fast-forward, which replays each source-branch commit individually onto the target branch so the target tip advances without creating a merge commit.
  • BA basic merge with a merge commit, which records all source-branch commits plus an extra merge commit that ties the two branch histories together on the target.
  • CSquash merge, which combines all commits on the source branch into a single new commit on the target branch when the pull request is completed. Correct
  • DSemi-linear merge, which rebases the source commits onto the target tip and then adds a merge commit to preserve a clear record of the pull request boundary.
Select the squash merge strategy when main must record exactly one commit per completed pull request. Squash merge takes all commits on the source branch and writes them as one new commit on the target, discarding the intermediate work-in-progress history from main. This yields a clean one-commit-per-pull-request line where reverting a whole feature is a single git revert of that commit.

Why A is wrong: Rebase and fast-forward preserves every individual feature commit on main, so a pull request adds many commits rather than one, failing the single-commit-per-PR requirement.

Why B is wrong: A standard merge keeps each work-in-progress commit and adds a merge commit, so the history grows by many commits per pull request instead of the single commit the team wants.

Why C is correct: Squash merge collapses every feature-branch commit into one commit on main, giving exactly one commit per pull request and making a feature revert a single-commit operation as required.

Why D is wrong: Semi-linear merge is tempting for tidy history, but it still keeps the individual rebased commits alongside a merge commit, so reverting the feature is not a single-commit action.

Free sampleDesign and Implement a Source Control Strategymedium

A vendor ships an on-premises desktop product on a scheduled quarterly cadence and must keep three previously shipped versions patchable in the field at the same time, while preparing the next version and parking experimental work, all in one repository. Releases are planned events rather than continuous, and each shipped version needs its own maintenance line. Which branching model best fits this delivery situation?

  • AGitFlow, with a develop integration branch, feature branches for new work, dedicated release branches per planned version, and hotfix branches that maintain each shipped version independently. Correct
  • BTrunk-based development, where every developer integrates small changes to a single shared main branch many times a day and the team releases directly from that one continuously deployable line.
  • CGitHub flow, where each change is made on a short-lived branch off main, reviewed through a pull request, and deployed to production the moment it merges back into main.
  • DA forking workflow, where each contributor maintains a personal server-side fork and proposes changes back to the central repository only through pull requests raised across those forks.
Choose GitFlow when a scheduled-release product must maintain several shipped versions in parallel within one repository. GitFlow keeps long-lived develop and release branches plus per-version hotfix branches, so multiple shipped versions can each receive isolated maintenance while new work proceeds on develop. That parallel, scheduled, multi-version structure is what a vendor patching several field releases at once needs, which lighter single-line models cannot provide.

Why A is correct: GitFlow provides long-lived develop, release, and hotfix branches that let several shipped versions be maintained in parallel on a scheduled cadence, which directly matches a vendor patching three field versions while preparing the next.

Why B is wrong: Trunk-based development suits continuous delivery from one line, but it offers no durable per-version maintenance branches, so patching three older shipped versions in parallel becomes awkward and conflicts with the scheduled, multi-version requirement.

Why C is wrong: GitHub flow is tempting for its simplicity, but it assumes a single always-current production version deployed on merge, so it provides no mechanism to maintain three older shipped versions side by side.

Why D is wrong: A forking workflow addresses contribution access for untrusted authors, not parallel version maintenance, so it does nothing to give each shipped quarterly version its own patchable line.

Free sampleDesign and Implement a Source Control Strategymedium

A team using "Azure Repos" wants every pull request into the main branch to gather at least two approvals before it can complete, and an approval given on one revision must be discarded if the author pushes new commits. Which branch policy on the main branch enforces both requirements?

  • AAdd a build validation policy that queues a pipeline on each pull request, and rely on the pipeline to count approvals and fail when fewer than two reviewers have signed off on the latest commit.
  • BConfigure the automatically included reviewers policy to add two named reviewers to every pull request, since their presence on the request forces two approvals before the merge button unlocks.
  • CConfigure a status check policy posted by an external service that records reviewer names, and block completion until the service reports that two distinct approvals exist on the head commit.
  • DConfigure the require a minimum number of reviewers policy with the count set to two and enable resetting approvals whenever the source branch is updated with new commits. Correct
Use the minimum reviewers branch policy with reset-on-push to enforce an approval count that re-validates after new commits. The require a minimum number of reviewers branch policy in Azure Repos lets you set the approval count and offers an option to reset approval votes when the source branch is pushed. Together these guarantee the configured number of fresh approvals against the latest commit before completion is allowed.

Why A is wrong: Build validation runs a pipeline and gates on its result; it is tempting because it does block completion, but it does not count human approvals or reset them on a new push, so it cannot enforce the reviewer rule.

Why B is wrong: Automatically included reviewers only adds people to the request; it is tempting because two reviewers appear, but it does not require them to approve nor reset approvals, so the merge is not actually gated.

Why C is wrong: Status checks gate on an external service signal and could be wired to track approvals, but this is custom plumbing that duplicates a built-in policy and still would not reset approvals automatically on push.

Why D is correct: This branch policy enforces a minimum approval count and its reset-on-push option invalidates stale approvals when new commits arrive, which matches both stated requirements exactly.

Free sampleDesign and Implement a Source Control Strategyhard

A developer accidentally committed a plaintext connection string into a file twenty commits ago, and the secret has since been pushed and pulled by the whole team. Leadership wants the secret removed from the entire history of the repository, not just the latest commit, before the credential is rotated. Which tool and action most directly rewrites history to purge the secret from every commit?

  • ARun "git revert" against the offending commit so a new commit undoes the change, which removes the secret from the current tree while preserving the original commit for audit purposes.
  • BRun "git rm" on the file and commit the deletion, then push, so the file no longer appears in the working tree and the secret is gone from the branch tip going forward.
  • CAdd the file to a gitignore entry and force a garbage collection pass so unreachable objects are pruned, which clears the secret from the object database during the next maintenance run.
  • DRun "git filter-repo" to strip the file from every commit, rewriting history across all branches, then force-push the cleaned history and have the team re-clone the repository. Correct
Use git filter-repo to rewrite history and remove a leaked file from every commit, not just the latest one. A secret embedded in old commits is still reachable until history is rewritten. git filter-repo rebuilds every affected commit without the target path, producing new commit hashes across all branches. A force-push then replaces the remote history, after which the credential must still be rotated because it was already exposed.

Why A is wrong: A revert only adds a compensating commit on top, so the connection string still exists in the earlier commit's history and can be read by anyone checking out that commit.

Why B is wrong: Removing and committing deletes the file from the latest snapshot only, leaving the secret fully recoverable in every prior commit, which fails the requirement to purge it from all history.

Why C is wrong: Ignoring an already-tracked file has no effect on existing commits, and garbage collection only prunes truly unreachable objects, so the still-referenced secret survives in history.

Why D is correct: git filter-repo rewrites every commit to remove the targeted path, which is the supported way to expunge a leaked secret from the full history before force-pushing and rotating the credential.

Free sampleDesign and Implement a Source Control Strategyhard

An engineering group has consolidated dozens of services into one very large Git monorepo, and developers complain that everyday operations such as clone, status, and checkout are slow because each working copy materialises the entire repository. The team wants Git to fetch only the files a developer actually touches while keeping a single repository. Which tooling best delivers that on-demand, reduced-footprint working experience?

  • AAdopt "Scalar" to manage the clone, enabling features such as partial clone and sparse checkout so Git downloads objects and populates files on demand rather than materialising the whole monorepo. Correct
  • BSplit the monorepo into one submodule per service so each developer initialises only the submodules they need, keeping the top-level repository small for everyone on the team.
  • CConfigure Git Large File Storage across the source tree so the bulk of the repository content is stored as pointers and the working files download only when each file is checked out.
  • DRun periodic "git gc --aggressive" on each clone so object packing keeps the repository compact, which reduces the time clone and checkout take across the whole monorepo.
Use Scalar to apply partial clone, sparse checkout, and maintenance so very large monorepos fetch content on demand. Scalar wraps a Git clone with settings tuned for very large repositories: partial clone defers blob downloads, sparse checkout limits the populated working tree to needed paths, and scheduled maintenance keeps the object store healthy. Together these let developers operate against a fraction of the monorepo without abandoning the single repository.

Why A is correct: Scalar configures large-repository optimisations including partial clone, sparse checkout, and background maintenance, so developers work against a reduced footprint that fetches content on demand, which matches the requirement.

Why B is wrong: Submodules tempt because they shrink an individual checkout, but they abandon the single-repository goal and add nested-pointer complexity the team explicitly wanted to avoid.

Why C is wrong: Git Large File Storage targets large binary blobs, not the many small source files driving monorepo slowness, so applying it across source code does not address the partial-checkout need.

Why D is wrong: Aggressive garbage collection repacks objects and helps slightly, but it still requires a full working copy and does not enable the on-demand partial fetch the scenario calls for.

Other domains in this exam

See also the AZ-400 cert hub, the study guide, and the cheat sheet.

Examworthy is not affiliated with or endorsed by Microsoft. Original, blueprint-aligned practice material only.