Design and implement a source control strategy · Topic 2 of 3

Large Files, Repository Scale, Permissions and Tags

AZ-400 repository management: Git LFS and git-fat for large files, Scalar for scale, repository permissions in Azure Repos and GitHub, and tags.

  • 5 min
In a nutshell
  • Git LFS keeps pointers in Git and content on an LFS server. git lfs track edits .gitattributes.
  • git-fat is the older equivalent. Scalar optimizes large repositories (partial clone, sparse checkout, maintenance).
  • Submodules pin another repository. Packages share libraries.

What it is

Git is built for text. Large binary files, huge histories and loose access make repositories slow, bloated and risky. This topic covers keeping a repository healthy: large file storage, scaling and optimizing big repositories, sharing code across repositories, permissions, and tags that mark releases.

Large binariesdesigns, modelsGit LFSpointers in GitLFS storereal file contentFast clonessmall repository

How it works

Large files

Git stores every version of every file forever. A large binary that changes often can make the history grow by the size of the file every time, and every clone downloads all of it.

OptionHow it works
Git LFS (Large File Storage)Replaces large files in the repository with small text pointers and stores the real content on a separate LFS server. Clones download only the versions you check out. Supported by both GitHub and Azure Repos
git-fatAn older tool with the same idea: large files live in a separate store and Git keeps pointers. Git LFS is the mainstream choice today
Package feedsBuild outputs and dependencies belong in Azure Artifacts or GitHub Packages, not in Git

Set up Git LFS by installing it, then telling it which patterns to manage.

git lfs install
git lfs track "*.psd"
git add .gitattributes
git add design.psd
git commit -m "Track Photoshop files with LFS"

git lfs track writes the rule into .gitattributes, which you must commit. Files already committed stay in the old history unless you migrate them (git lfs migrate).

Scaling and optimizing a large repository

TechniqueWhat it does
Shallow clone (--depth 1)Downloads only recent history. Common in pipelines
Partial clone (--filter=blob:none)Downloads commits and trees, and fetches file contents only when needed
Sparse checkoutChecks out only chosen folders in the working directory
ScalarA tool that configures a large repository for performance. It turns on partial clone, sparse checkout, background maintenance and file system monitoring. Run scalar clone <url>. It is included with Git
git maintenanceScheduled background tasks such as prefetch, commit graph updates and garbage collection

Pipelines can use a shallow fetch to save time, but jobs that need full history, such as versioning from tags or computing a changelog, must fetch the depth they need.

Sharing code across repositories

ApproachWhen to use
Git submodulesPin another repository at an exact commit inside yours. Good for a stable shared component. Clones need --recurse-submodules
Git subtreeCopies another repository's content into a folder with history. No special clone steps
PackagesPublish shared code as a versioned package to a feed. Best for libraries with many consumers
MonorepoKeep related projects in one repository for atomic changes and easy sharing. Needs the scale tools above

Permissions

PlatformHow access is controlled
Azure ReposSecurity groups such as Readers, Contributors and Project Administrators. Permissions (Read, Contribute, Create branch, Create tag, Force push, Bypass policies, Manage permissions) are set to Allow, Deny or inherit, at the project, repository, branch or folder level
GitHubRepository roles Read, Triage, Write, Maintain, Admin, assigned to people and teams. Outside collaborators get access to specific repositories only. Branch rules and CODEOWNERS add control

Give the least privilege that does the job and prefer groups or teams over individuals. In Azure DevOps, an explicit Deny overrides Allow.

Tags

A tag is a named pointer to a commit, used to mark releases.

TypeDetails
LightweightJust a name for a commit
AnnotatedStores the tagger, date and a message. Preferred for releases (git tag -a v1.4.0 -m "Release 1.4.0")

Tags are not pushed by default. Push one with git push origin v1.4.0, or all with git push origin --tags. Use consistent names such as semantic versions, and restrict who can create or delete release tags (a GitHub tag ruleset, or the Create tag and Manage tags permissions in Azure Repos).

A worked scenario

A game studio's repository takes 40 minutes to clone because of texture files. They move *.png and *.fbx to Git LFS, use partial clone and sparse checkout for artists who need one title, give build agents a shallow clone, and tag each release with an annotated tag that the release pipeline watches.

What to remember for the exam

  • Git LFS keeps pointers in Git and content on an LFS server. git lfs track edits .gitattributes.
  • git-fat is the older equivalent. Scalar optimizes large repositories (partial clone, sparse checkout, maintenance).
  • Submodules pin another repository. Packages share libraries.
  • GitHub roles: Read, Triage, Write, Maintain, Admin. Outside collaborators get repository level access.
  • Tags are not pushed unless you push them. Annotated tags carry a message.
Exam tip

"Repository is huge because of binaries" means LFS. "Clone is slow but history is needed" means partial clone or Scalar.

How the exam asks about this

  • "Store design files without bloating the repository." Git LFS.
  • "Speed up cloning of a very large monorepo." Scalar, partial clone and sparse checkout.
  • "Give a contractor access to one repository only." GitHub outside collaborator.
  • "Make sure the release tag appears on the server." Push the tag explicitly.

Common mistakes

Tracking with LFS but not committing .gitattributes. Others will commit the binaries normally.

Expecting LFS to fix old history. Existing commits keep the large files until migrated.

Using full history in every pipeline run. A shallow fetch is faster where history is not needed.

Per person permissions. Teams are easier to audit and change.

Check yourself

  • What does Git LFS store in the repository in place of a large file?

    A small text pointer, with the content on the LFS server.

  • Which command pushes all local tags to the remote?

    git push origin --tags.

  • Which Scalar related technique downloads file contents only when they are needed?

    Partial clone.

Topic 2 of 3 in Design and implement a source control strategy

Test yourself on Design and implement a source control strategy

The full Microsoft AZ-400 question bank has 766 questions, with timed practice exams and an explanation for every answer.

This study guide is independent and is not affiliated with, endorsed by, or sponsored by Microsoft. Vendor names, certification names and exam codes are trademarks of their respective owners and are used for identification only.