Git Large File Storage

Git LFS: 0 to Infinity Lesson

Learn what happened in your PowerShell screen, why those commands matter, and how to safely store large files like MP4, ZIP, PSD, WAV and FBR without making your Git repository painfully heavy.

PowerShell showing git lfs track commands for mp4, zip, psd, wav and fbr files
Your screen shows Git LFS tracking rules being created for large file types.

0. What your screen means

In the screenshot, you are inside this folder:

PS D:\videos>

Then you ran these commands:

git lfs track "*.mp4"
git lfs track "*.zip"
git lfs track "*.psd"
git lfs track "*.wav"
git lfs track "*.fbr"

Git LFS replied with lines like:

Tracking "*.mp4"

This means: from now on, files matching these patterns should be handled by Git LFS instead of being stored directly as heavy binary objects inside normal Git history.

1. Why Git LFS exists

Git is wonderful for code because text files are small and Git can compare them line by line. Large binary files are different. A video, design file, ZIP file, or recorded screen file may be hundreds of MB.

Normal Git

Stores the full large file in Git history.

Repo becomes heavy, clone becomes slow, and deleting the file later does not easily remove it from history.

Git LFS

Stores a tiny pointer in Git.

The real large file is stored separately in LFS storage and downloaded when needed.

2. Simple mental model

Think of Git as your notebook. Git LFS is a storage room. Instead of pasting a heavy poster into the notebook, you write a small note saying where the poster is stored.

video.mp4
small LFS pointer in Git
real file in LFS storage

The project still looks normal on your computer. You can open the MP4 or ZIP as usual. But internally, Git is not carrying the full heavy file inside the ordinary repository history.

3. Commands from zero

Step A: Install and initialize LFS

git lfs install

Step B: Track large file types

git lfs track "*.mp4"
git lfs track "*.zip"
git lfs track "*.psd"
git lfs track "*.wav"
git lfs track "*.fbr"

Step C: Add the tracking file

git add .gitattributes
git commit -m "track large files with git lfs"

Step D: Add your real files

git add .
git commit -m "add large media files"
git push

4. The important file: .gitattributes

The command git lfs track creates or updates a file named .gitattributes. This file tells Git which file patterns should go through LFS.

*.mp4 filter=lfs diff=lfs merge=lfs -text
*.zip filter=lfs diff=lfs merge=lfs -text
*.psd filter=lfs diff=lfs merge=lfs -text
*.wav filter=lfs diff=lfs merge=lfs -text
*.fbr filter=lfs diff=lfs merge=lfs -text

Commit this file. Without committing .gitattributes, other computers may not know that these file types belong to LFS.

5. Correct workflow

Good order

git lfs install
git lfs track "*.mp4"
git add .gitattributes
git commit -m "track mp4 with lfs"
git add intro.mp4
git commit -m "add intro video"
git push

Risky order

git add intro.mp4
git commit -m "add video"
git lfs track "*.mp4"

Track first, then add large files. If the large file was already committed before tracking, it may already be inside normal Git history.

6. How to verify

Check which files are handled by Git LFS:

git lfs ls-files

Check the tracking rules:

git lfs track

Check Git status:

git status

7. Common mistakes and fixes

I tracked a file type after committing the large file.

The file may already be stored in normal Git history. For simple projects, remove it, commit, then add it again after tracking. For serious history cleanup, use tools such as git lfs migrate carefully.

GitHub says the file is too large.

Track the file type with Git LFS before committing. Also check whether the file was already committed earlier in normal Git history.

Another computer downloads only pointer files.

Run git lfs install, then git lfs pull.

LFS bandwidth or storage is exceeded.

LFS storage and bandwidth may have limits depending on your Git hosting provider. For public websites, very large downloadable files may be better stored on a dedicated storage/CDN service.

8. Git LFS and GitHub Pages

For normal lesson pages, you usually do not need Git LFS for HTML, CSS, JS, small SVGs, or compressed SEO images.

Use Git LFS for large assets such as lesson videos, audio intros, large ZIP downloads, raw PSD files, or big screen recordings.

∞. Advanced commands

Download LFS files after clone

git lfs pull

See LFS environment

git lfs env

Track a folder pattern

git lfs track "videos/**"

Migrate existing files carefully

git lfs migrate import --include="*.mp4,*.zip,*.psd,*.wav,*.fbr"

Use migration commands carefully, especially on shared repositories. They rewrite history.

Practice quiz

  1. What does git lfs track "*.mp4" do?

  2. Which file stores LFS tracking rules?

  3. Should you track before adding large files?