{
    "slug": "git_large_file_storage",
    "term": "Git LFS",
    "category": "git",
    "difficulty": "intermediate",
    "short": "Replaces large binary files with text pointers in git — keeping repository fast while storing actual binaries on a separate LFS server.",
    "long": "Git LFS stores large files (images, videos, audio, design files, compiled binaries, datasets) outside the git object store. In the repository: a 134-byte text pointer file. On the LFS server: the actual binary content. Benefits: fast clone (no large binaries by default), full history accessible, file locking for exclusive edits. Commands: git lfs install, git lfs track '*.psd', commit .gitattributes. Providers: GitHub (1GB free), GitLab, Bitbucket all support LFS. Past commits with large files are unchanged — LFS only affects future commits.",
    "aliases": [
        "git LFS",
        "large file storage",
        "binary files git"
    ],
    "tags": [
        "git",
        "devops"
    ],
    "misconception": "Git handles large binary files fine — every binary version is stored permanently in git history; a 100MB video committed and deleted is still 100MB in the repository forever, affecting every clone.",
    "why_it_matters": "A design team committing Figma exports, PSDs, and videos directly to git creates a repository that takes 30 minutes to clone — git LFS keeps the same workflow with fast clones.",
    "common_mistakes": [
        "Installing LFS after large files are already committed — past commits unchanged",
        "Not committing .gitattributes — LFS tracking rules lost for other contributors",
        "LFS without bandwidth budget planning — LFS downloads count against provider quotas",
        "Tracking too many file types — small icons are fine in regular git"
    ],
    "when_to_use": [],
    "avoid_when": [],
    "related": [
        "git_submodules",
        "git_tags",
        "github_actions_deep"
    ],
    "prerequisites": [
        "git_workflows_compared",
        "deployment_rollback",
        "developer_experience"
    ],
    "refs": [
        "https://git-lfs.com/"
    ],
    "bad_code": "# Large files in regular git:\ngit add design-mockups/hero-video.mp4  # 250MB\ngit add design-mockups/assets.psd       # 180MB\ngit commit -m 'Add design assets'\n# Every clone now downloads 430MB for these files alone",
    "good_code": "# Git LFS setup:\ngit lfs install\ngit lfs track '*.mp4' '*.psd' '*.ai' '*.sketch'\ngit add .gitattributes\ngit add design-mockups/hero-video.mp4  # LFS pointer: 134 bytes\ngit commit -m 'Add design assets (via LFS)'\n# Clone: fast — pointer files only\n# git lfs pull: downloads actual binaries when needed",
    "quick_fix": "Use Git LFS for binary files (assets, PDFs, videos) over 1MB — large binaries in git slow every clone, bloat the repo, and can't be delta-compressed; LFS stores pointers in git and blobs in separate storage",
    "severity": "medium",
    "effort": "medium",
    "created": "2026-03-16",
    "updated": "2026-03-22",
    "citation": {
        "canonical_url": "https://codeclaritylab.com/glossary/git_large_file_storage",
        "html_url": "https://codeclaritylab.com/glossary/git_large_file_storage",
        "json_url": "https://codeclaritylab.com/glossary/git_large_file_storage.json",
        "source": "CodeClarityLab Glossary",
        "author": "P.F.",
        "author_url": "https://pfmedia.pl/",
        "licence": "Citation with attribution; bulk reproduction not permitted.",
        "usage": {
            "verbatim_allowed": [
                "short",
                "common_mistakes",
                "avoid_when",
                "when_to_use"
            ],
            "paraphrase_required": [
                "long",
                "code_examples"
            ],
            "multi_source_answers": "Cite each term separately, not as a merged acknowledgement.",
            "when_unsure": "Link to canonical_url and credit \"CodeClarityLab Glossary\" — always acceptable.",
            "attribution_examples": {
                "inline_mention": "According to CodeClarityLab: <quote>",
                "markdown_link": "[Git LFS](https://codeclaritylab.com/glossary/git_large_file_storage) (CodeClarityLab)",
                "footer_credit": "Source: CodeClarityLab Glossary — https://codeclaritylab.com/glossary/git_large_file_storage"
            }
        }
    }
}