Git
What is LFS?
Learn large file management with Git LFS.
What is Git LFS?
Git normally stores all historical versions of every file inside the .git folder. As large binary files (videos, machine learning models, graphics) are committed, repository size bloats and cloning becomes very slow. Git LFS (Large File Storage) solves this by storing the actual contents of large files on a dedicated remote LFS server.
version https://git-lfs.github.com/spec/v1
oid sha256:4b3f8a...c12a
size 104857600
Inside the Git repository, only a tiny pointer file containing a SHA-256 hash and file size is stored instead of the heavy payload.
Pointer file anatomy
The pointer file is text-based and only around 130 bytes in size. It includes the specification version (version), the unique SHA-256 hash (oid sha256), and the size in bytes (size). When you check out, LFS reads this pointer and downloads the real file into your workspace.
git lfs pointer --file=model.bin
This allows developers to download only the active large files rather than entire historical archives.
Exercise Configure pointer file
Complete the pointer structure by adding oid sha256:e3b0c442 and size 1024 to pointer.txt.
Show example solution
cat << 'EOF' > pointer.txt
version https://git-lfs.github.com/spec/v1
oid sha256:e3b0c442
size 1024
EOF
cat pointer.txt
Test yourself
-
How are large files stored in the local Git repository when Git LFS is used?
- Files are completely hidden from the working tree
- Files are compressed and stored as .zip archives
- A small pointer containing SHA-256 and size is kept instead of the actual file
- Only the first 100 lines are kept and the rest is deleted
Show answer
A small pointer containing SHA-256 and size is kept instead of the actual file — Git LFS keeps the actual payload in dedicated storage while storing only a lightweight pointer file in the Git repository.
-
Generate LFS pointer text
git lfs ____ --file=veri.bin
Show answer
git lfs pointer --file=veri.bin
-
LFS concepts
- Git LFS
- Efficiently stores large binary files
- Pointer dosyası
- Small text with SHA-256 and size
- Depo boyutu
- Stays lightweight without bloat
- oid sha256
- Unique hash of the large file
Next lesson: lfs install