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 Shallow Clone Breaking a Bisect Run Midway

- 28.11.26 - ErcanOPAK

🔀 Fix a Shallow Clone Breaking a Bisect Run Midway

git bisect walks the commit graph with a binary search, and that search can land on any commit between the known-good and known-bad marks, including one that falls outside a shallow clone’s depth boundary. A shallow clone built with –depth=N only has commit objects for the most recent N commits, so when bisect’s next step needs to check out something older than that boundary, git has no object for it at all – not a tree, not even the commit itself – and the bisect run stops cold, several steps in, with no way to resume past the point where history was cut off.

🔎 The Problem

$ git bisect start
$ git bisect bad HEAD
$ git bisect good v2.3.0
Bisecting: 47 revisions left to test after this (roughly 6 steps)
[a1b2c3d] Merge pull request #812 ...

$ git bisect good
Bisecting: 23 revisions left to test after this (roughly 5 steps)
...
$ git bisect bad
fatal: bad object a9f0012
# the commit bisect wants to check out next is older than this
# repository's shallow clone boundary (--depth=50 at clone time) -
# git has no commit object for it at all, not even a tree reference

✅ Fix: Unshallow Before You Bisect

  • Run git fetch –unshallow (or git fetch –depth with a number comfortably larger than the range you need to bisect) before starting the session, converting the clone to full history so every commit bisect might need actually exists locally.
  • If the CI runner’s default clone is shallow and bisect needs to run there specifically, add an explicit unshallow fetch step before the bisect job starts, rather than assuming a shallow clone tuned for build speed will also work for an unrelated history-walking command.
  • If unshallowing the whole repository is too slow or too large, bound the bisect range itself first against a known-good tag that’s within the shallow depth, so bisect never needs to walk past the point where history was cut off in the first place.

🚨 Why This Is Dangerous

A bisect run that fails midway with a cryptic ‘bad object’ error wastes every step already completed – there’s no way to resume a shallow-clone bisect once it crosses the depth boundary short of unshallowing and starting the whole binary search over from the first bad/good marks.

git bisect doesn’t know your clone is shallow until it tries to walk past the edge of it – at which point the search it already ran several steps into simply stops being usable.

— Version Control Tip

Related posts:

Git Pull Breaks Local Changes Silently

Git Pull Breaks Local Changes Silently

Git Repositories Become Hard to Maintain

Git Repositories Become Hard to Maintain

Git: Working with Git Worktrees for Multiple Branches

Git: Working with Git Worktrees for Multiple Branches

Views: 8
Found this useful? Share it
XLinkedInWhatsApp

Post navigation

Photoshop: Fix a Pattern Stamp Drifting Off Its Clone Source
Photoshop: Fix a Gradient Map Banding After Exporting to PNG

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 562 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