Skip to content
  • Home
  • About
  • No Access
  • Privacy Policy
Bits of .NET
Bits of .NET
  • C#
  • Asp.Net Core
  • SQL
  • Windows
  • WordPress
  • AI
  • JavaScript
  • CSS
  • MORE
    • HTML
    • Ajax
    • Git
    • Docker
    • Kubernetes
    • Photoshop
    • Visual Studio

Bits of .NET

Daily micro-tips for C#, SQL, performance, and scalable backend engineering.

  • C#
  • Asp.Net Core
  • SQL
  • Windows
  • WordPress
  • AI
  • JavaScript
  • CSS
  • MORE
    • HTML
    • Ajax
    • Git
    • Docker
    • Kubernetes
    • Photoshop
    • Visual Studio
Git

Git: Use Git LFS for Large File Storage

- 09.07.26 - ErcanOPAK

📁 Git LFS = Large File Storage

Git repos get bloated. Git LFS stores large files efficiently. Images, videos, binaries — keep repo fast.

📝 Git LFS Setup

# Install Git LFS
# macOS
brew install git-lfs

# Linux
sudo apt install git-lfs

# Windows
# Download from https://git-lfs.github.com

# Initialize LFS
git lfs install

# Track file types
git lfs track "*.psd"
git lfs track "*.png"
git lfs track "*.jpg"
git lfs track "*.mp4"
git lfs track "*.zip"
git lfs track "*.pdf"

# Track specific files
git lfs track "assets/logo-large.png"

# View tracked patterns
git lfs track

# .gitattributes (auto-generated)
*.psd filter=lfs diff=lfs merge=lfs -text

# Commit LFS files
git add .gitattributes
git add *.psd
git commit -m "Add large files with LFS"
git push origin main

# Migrate existing files to LFS
git lfs migrate import --include="*.psd,*.png"

# Migrate with history rewrite
git lfs migrate import --include="*.psd" --everything

🎯 Advanced LFS Commands

# Clone with LFS
git clone repository-url
# LFS files download automatically

# Clone without LFS (placeholder)
GIT_LFS_SKIP_SMUDGE=1 git clone repository-url

# Fetch specific LFS files
git lfs pull --include="specific-file.png"

# Check LFS status
git lfs status
git lfs ls-files

# Environment variables
export GIT_LFS_DOWNLOAD=true
export GIT_LFS_SKIP_PUSH=true
export GIT_LFS_STORAGE=100MB

# Check LFS storage usage
git lfs quota

# Debug LFS operations
GIT_TRACE=1 git push origin main
GIT_CURL_VERBOSE=1 git lfs fetch

# LFS with SSH
git config lfs.url ssh://git@server/path/to/repo.git

# Verify LFS files
git lfs fsck

# Clean LFS cache
git lfs prune

# LFS in CI/CD
# GitHub Actions
- name: Checkout
  uses: actions/checkout@v3
  with:
    lfs: true

💡 LFS Best Practices

  • Only use for large files (over 1MB)
  • Set .gitattributes early
  • Monitor LFS storage limits
  • Use LFS in CI/CD pipelines
  • Consider storage costs

“Git LFS handles large files. Images, videos, binaries. Essential for game dev, media, and design.”

— Game Developer

Related posts:

Git: Use Git Stash to Save Work Temporarily

Git: Use Git Stash to Save Work Temporarily

Git: Resolve Merge Conflicts Like a Pro

Git: Resolve Merge Conflicts Like a Pro

Git: Fix a Submodule Pointing to a Commit That No Longer Exists

Git: Fix a Submodule Pointing to a Commit That No Longer Exists

Views: 27
Found this useful? Share it
XLinkedInWhatsApp

Post navigation

Ajax: Use Server-Sent Events for One-Way Real-Time
.NET Core: Build Lightweight APIs with Minimal APIs

Leave a Reply Cancel reply

Your email address will not be published. Required fields are marked *

Most Read

  1. 01How to make theater mode the default for Youtube 1,080 views
  2. 02How to add default value for Entity Framework migrations for DateTime and Bool 999 views
  3. 03Get the User Name and Domain Name from an Email Address in SQL 998 views
  4. 04Get the First and Last Word from a String or Sentence in SQL 874 views
  5. 05How to select distinct rows in a datatable in C# 869 views
  6. 06How to enable, disable and check if Service Broker is enabled on a database in SQL Server 673 views
  7. 07Add Constraint to SQL Table to ensure email contains @ 632 views
  8. 08Average of all values in a column that are not zero in SQL 586 views
  9. 09How to use Map Mode for Vertical Scroll Mode in Visual Studio 563 views
Bits of .NET

Daily micro-tips for C#, SQL, performance, and scalable backend engineering.

Social

  • ErcanOPAK.com
  • GoodReads
  • LetterBoxD
  • Linkedin
  • The Blog
  • Twitter
Back to top
© 2026 Bits of .NET | Built with Xblog Plus free WordPress theme by wpthemespace.com