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: Fix a Sparse-Checkout Silently Excluding a New Subfolder

- 26.11.26 - ErcanOPAK

🔀 Git: Fix a Sparse-Checkout Silently Excluding a New Subfolder

Both cone-mode and pattern-mode sparse-checkout match what gets checked out by explicit paths or gitignore-style patterns set up ahead of time – a brand new subfolder added upstream later doesn’t automatically become visible just because it’s a child of an already-included parent, unless the original pattern was written broadly enough (a trailing /* or a parent-level entry) to already cover it. A pattern that named today’s specific subfolders explicitly keeps working for exactly those folders forever, while a new sibling folder added later in that same parent directory simply never appears in the working tree – sparse-checkout’s entire design is to silently not check out whatever isn’t listed, so there’s no warning that anything was left out.

🔎 The Problem

cat .git/info/sparse-checkout
src/api/
src/web/

# Upstream adds a new top-level feature area:
git pull
ls src/
# api/  web/        <- src/billing/ was added upstream but never
#                      appears here - not in the sparse-checkout list,
#                      so it's silently never checked out, no warning

✅ The Fix

  • Use cone mode (git sparse-checkout init –cone) with directory-level patterns and periodically run git sparse-checkout list to review exactly what’s currently included, instead of relying on memory of how it was set up originally.
  • When a new top-level feature area is added to the repo, add it explicitly with git sparse-checkout add <path> as a deliberate step in that area’s own onboarding process, rather than assuming existing sparse-checkout setups will pick it up on their own.
  • If broad coverage of an entire parent directory is actually what’s intended, set the pattern at that parent level (src/*) instead of listing today’s subfolders individually, so a new sibling added later is included by the pattern’s own shape rather than by luck.

🚨 Why This Is Dangerous

A developer working inside a sparse checkout can have no idea a folder even exists in the repository at all, and ‘I don’t see it in my working tree’ is easy to mistake for ‘it doesn’t exist yet’ or ‘it hasn’t been merged,’ sending them looking for an answer in entirely the wrong place.

Sparse-checkout doesn’t warn you about what it’s leaving out – a new folder is invisible by default, not included by default.

— Version Control Tip

Related posts:

Git: Fix a Sparse Checkout That Silently Hides Files You Expect to See in Your Working Directory

Git: Fix a Sparse Checkout That Silently Hides Files You Expect to See in Your Working Directory

Git: Writing Commits That Your Future Self Won't Hate

Git: Writing Commits That Your Future Self Won't Hate

Git: Use Cherry-pick to Select Specific Commits

Git: Use Cherry-pick to Select Specific Commits

Views: 9
Found this useful? Share it
XLinkedInWhatsApp

Post navigation

Visual Studio: Fix a Stale Live Unit Test Icon After a Rename
Ajax: Fix a Retry Loop Re-sending a Request After a 304 Response

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,079 views
  2. 02How to add default value for Entity Framework migrations for DateTime and Bool 997 views
  3. 03Get the User Name and Domain Name from an Email Address in SQL 996 views
  4. 04Get the First and Last Word from a String or Sentence in SQL 873 views
  5. 05How to select distinct rows in a datatable in C# 868 views
  6. 06How to enable, disable and check if Service Broker is enabled on a database in SQL Server 671 views
  7. 07Add Constraint to SQL Table to ensure email contains @ 631 views
  8. 08Average of all values in a column that are not zero in SQL 584 views
  9. 09How to use Map Mode for Vertical Scroll Mode in Visual Studio 561 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