CodeBlanks Logo Icon CodeBlanks

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.

Practice Configure pointer file

Complete the pointer structure by adding oid sha256:e3b0c442 and size 1024 to pointer.txt.

Starter code

terminal
cat << 'EOF' > pointer.txt
version https://git-lfs.github.com/spec/v1
# oid sha256 ve size tanimla
EOF

cat pointer.txt

Sample solution

terminal
cat << 'EOF' > pointer.txt
version https://git-lfs.github.com/spec/v1
oid sha256:e3b0c442
size 1024
EOF

cat pointer.txt

Expected output

version https://git-lfs.github.com/spec/v1
oid sha256:e3b0c442
size 1024

Questions and answers

Review the lesson questions together with their answers. To test yourself, solve the lesson interactively.

1 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 Correct answer
  • Only the first 100 lines are kept and the rest is deleted

Explanation: Git LFS keeps the actual payload in dedicated storage while storing only a lightweight pointer file in the Git repository.

2 Generate LFS pointer text

Question
git lfs ____ --file=veri.bin
Answer
git lfs pointer --file=veri.bin

Explanation: The git lfs pointer --file=<file> command generates the LFS pointer text for the specified file.

3 LFS concepts

Term Meaning
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

All lessons in Expert