Skip to content

AZ-400 · Domain 2: Design and implement a source control strategy · 13% of the exam

Task 2.2: Configure and manage repositories

Large files with Git LFS and git-fat, scaling repositories with Scalar and cross-repository sharing, repository permissions and tags, and recovering or removing specific data with Git commands.

Study it

  • Large files and large repositories: Git LFS, git-fat and Scalar

    Lesson coming

  • Repository permissions, tags, recovering data and removing data from history

    Lesson coming

Sample questions

Try each one before opening the answer. Every option is explained, with the Microsoft documentation page that proves it.

Question 1 · choose 1

A game studio's repository holds source code and large textures that change often, and every clone downloads every version of every texture. Developers want normal Git commands, clones that fetch only the texture versions they check out, and the build pipeline to receive the textures. What should you do?

  1. AUse shallow fetch on developer clones and keep the textures in Git
  2. BStore the textures in a pipeline artifact that developers download
  3. CTurn on the Maximum file size repository policy at 1 MB
  4. DTrack the texture file types with Git LFS, and set lfs to true on the pipeline's checkout step
Show the answer and why
  • AUse shallow fetch on developer clones and keep the textures in Git

    Incorrect

    Shallow history helps clones, but every texture version still sits in the repository and grows it.

  • BStore the textures in a pipeline artifact that developers download

    Incorrect

    Developers would leave Git workflows for every texture change.

  • CTurn on the Maximum file size repository policy at 1 MB

    Incorrect

    That blocks the textures without giving them anywhere to live.

  • DTrack the texture file types with Git LFS, and set lfs to true on the pipeline's checkout step

    Correct

    LFS keeps large files on the server and downloads only the versions checked out; checkout needs lfs true to fetch them.

Git LFS stores large files on the server and replaces them in the repository with pointers, so clones download only the versions they need while Git commands work as usual. A pipeline's checkout step downloads LFS files only when lfs is set to true.

Question 2 · choose 2

A developer pushed a commit containing a storage account key to a shared repository two days ago, and others have pulled it. Security wants the exposure contained and the key gone from the repository's history. Which two actions should you take? (Choose TWO.)

  1. ARevoke the storage account key and generate a new one for the applications that use it
  2. BRevert the commit with git revert so the key disappears from the latest version
  3. CRewrite history with git filter-repo or BFG to remove the key, and force push the rewritten branches
  4. DDelete the repository and import a copy of it into a new project
  5. EAdd the file that held the key to .gitignore
Show the answer and why
  • ARevoke the storage account key and generate a new one for the applications that use it

    Correct

    Anyone who pulled has the key, so it must be invalidated and replaced.

  • BRevert the commit with git revert so the key disappears from the latest version

    Incorrect

    A revert adds a new commit and leaves the key in history.

  • CRewrite history with git filter-repo or BFG to remove the key, and force push the rewritten branches

    Correct

    These tools remove sensitive text from history, which then has to be force-pushed.

  • DDelete the repository and import a copy of it into a new project

    Incorrect

    An imported copy keeps the same history, and clones still hold the key.

  • EAdd the file that held the key to .gitignore

    Incorrect

    Ignoring a file affects future commits only; history keeps the key.

To remediate an exposed secret, invalidate the credential and create a new one. Tools such as git filter-repo and BFG Repo-Cleaner rewrite history to remove sensitive files or text, which requires a force push; a revert only adds a new commit.

Question 3 · choose 1

Developers on a very large monorepo wait a long time for clones and fetches, but each of them works in only a few folders. They want to keep one repository and normal Git, with faster clones, smaller working directories and fetches that stay fast over time. What should they use?

  1. AGit submodules for every top-level folder of the repository
  2. BGit LFS for every source file
  3. CScalar to clone and maintain the repository
  4. DA larger agent VM for developers' builds
Show the answer and why
  • AGit submodules for every top-level folder of the repository

    Incorrect

    Splitting into submodules changes the repository structure the team wants to keep.

  • BGit LFS for every source file

    Incorrect

    LFS is for large binary files, not ordinary source code.

  • CScalar to clone and maintain the repository

    Correct

    Scalar sets up partial clone, sparse-checkout and background prefetch and maintenance.

  • DA larger agent VM for developers' builds

    Incorrect

    Bigger build agents don't change clone and fetch on developer machines.

Scalar is a tool from Microsoft that helps very large repositories work faster by turning on Git features such as partial clone, background prefetch and sparse-checkout, plus background maintenance.

Question 4 · choose 1

After cleaning large build outputs out of an Azure Repos repository, the team wants to stop anyone from pushing new files over 50 MB again, enforced on the server for every client, while still allowing large files that go through Git LFS. What should you configure?

  1. AA pre-commit hook in each developer's clone that checks file sizes
  2. BA build validation policy that fails when the build output is large
  3. CThe Case enforcement repository policy
  4. DThe Maximum file size repository policy set to 50 MB
Show the answer and why
  • AA pre-commit hook in each developer's clone that checks file sizes

    Incorrect

    Client-side hooks can be skipped and aren't enforced on the server.

  • BA build validation policy that fails when the build output is large

    Incorrect

    That checks pull requests, not direct pushes, and after the fact.

  • CThe Case enforcement repository policy

    Incorrect

    That policy isn't about file size.

  • DThe Maximum file size repository policy set to 50 MB

    Correct

    The policy blocks pushes that add or update files larger than the limit, on the server.

The Maximum file size repository policy blocks pushes that contain new or updated files over the limit, enforced on the server for every client. Large files belong in Git LFS.

Question 5 · choose 1

A file was deleted in a commit a week ago. How can a developer restore it as it was in the commit before the deletion?

  1. Agit stash pop
  2. Bgit blame <file>
  3. Cgit fetch --all
  4. Dgit checkout <commit>^ -- <file>, then commit it
Show the answer and why
  • Agit stash pop

    Incorrect

    The stash holds uncommitted local work.

  • Bgit blame <file>

    Incorrect

    Blame shows line authorship, not a restore.

  • Cgit fetch --all

    Incorrect

    Fetching gets remote updates; it doesn't restore the file.

  • Dgit checkout <commit>^ -- <file>, then commit it

    Correct

    Checking out the file from the parent of the deleting commit restores it.

git checkout <commit> <file> restores a specific file from a previous commit; use the parent of the commit that deleted it, then commit the restored file.

Question 6 · choose 1

Windows developers keep hitting checkout problems because the repository has both Readme.md and README.md. What repository policy prevents this from happening again?

  1. AReserved names
  2. BMaximum path length
  3. CCommit author email validation
  4. DCase enforcement
Show the answer and why
  • AReserved names

    Incorrect

    That blocks platform-reserved names and characters.

  • BMaximum path length

    Incorrect

    That limits path length.

  • CCommit author email validation

    Incorrect

    It doesn't look at file or folder names.

  • DCase enforcement

    Correct

    It switches the server to case-insensitive behavior for paths and blocks case-only conflicts.

The Case enforcement policy switches the server from case-sensitive mode, where File.txt and file.txt are distinct, to a Windows-friendly mode that blocks case-only conflicts; it's recommended when most contributors use Windows or macOS.

Question 7 · choose 1

A branch with unmerged work was deleted from an Azure Repos repository six months ago, and nobody has a local copy. Can it be recovered?

  1. AYes, by searching for the deleted branch in the web portal and restoring it
  2. BNo, deleted branches are purged after 30 days
  3. COnly if someone still has a local clone with the branch in it
  4. DOnly with a support request to Microsoft
Show the answer and why
  • AYes, by searching for the deleted branch in the web portal and restoring it

    Correct

    You can restore a deleted branch from the Branches page at any time.

  • BNo, deleted branches are purged after 30 days

    Incorrect

    Deleted branches have no retention limit.

  • COnly if someone still has a local clone with the branch in it

    Incorrect

    The server keeps deleted branches restorable without a local copy.

  • DOnly with a support request to Microsoft

    Incorrect

    Users can restore branches themselves.

There's no retention policy on deleted branches in Azure Repos: you can find a deleted branch from the Branches view in the web portal and restore it at any time, regardless of when it was deleted.

Question 8 · choose 1

A team forks a repository in Azure Repos. Which of these comes over to the fork from the original?

  1. AThe original's branch policies
  2. BThe original's build pipelines
  3. CThe original's permissions
  4. DThe source code
Show the answer and why
  • AThe original's branch policies

    Incorrect

    Forking doesn't transfer policies.

  • BThe original's build pipelines

    Incorrect

    Pipelines aren't transferred.

  • CThe original's permissions

    Incorrect

    Permissions aren't transferred.

  • DThe source code

    Correct

    A fork shares the original repository's source code.

A fork is a new repository that shares the source code of the original. The forking process doesn't transfer permissions, policies or build pipelines.

Microsoft documentation

Practise domain 2 →Practise all domains →