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 Bisect Run Landing on an Unrelated Flaky Commit

- 27.11.26 - ErcanOPAK

🔀 Git: Fix a Bisect Run Landing on an Unrelated Flaky Commit

git bisect run trusts whatever exit code your test script returns at each step, and a flaky test that fails intermittently for reasons unrelated to the actual regression — a timing-sensitive integration test, say — can get marked ‘bad’ on a commit that never introduced the real bug at all. Bisect has no way to tell a genuine regression apart from a coin-flip failure, so it confidently reports whichever commit happened to draw the bad outcome during the automated run.

🔎 The Problem

git bisect start HEAD v2.3.0
git bisect run ./run-integration-tests.sh
# ...
# abc123f is the first bad commit
# -> turns out abc123f only touched documentation;
#    the integration test that failed is known to be flaky ~5% of runs

✅ Fix: Make the Script Retry Before Trusting a Failure

  • Have the bisect script run the suspect test several times (3-5) and only report ‘bad’ if it fails consistently, rather than exiting on the very first failure — this filters out single-run flakiness before it ever reaches bisect’s decision logic.
  • Use git bisect skip manually at any commit where you can independently confirm the result is unreliable (a known-flaky test, a broken unrelated build), so bisect continues searching around it instead of treating an inconclusive result as a verdict.
  • Where possible, replace the flaky integration test with a faster, more deterministic reproduction of just the suspected regression for the bisect run specifically — a narrower, more reliable check almost always beats a slower but shakier one for this purpose.

🚨 Why This Is Dangerous

  • Reverting or investigating the commit bisect blamed, when it was actually innocent, wastes real investigation time while the true regression — introduced somewhere else in the range — keeps shipping untouched in every subsequent build.

Bisect is only as reliable as the test you hand it — ask a coin flip a question enough times and it will eventually ‘find’ a culprit.

— Version Control Tip

Related posts:

Git: Use Rebase for Clean Commit History

Git: Use Rebase for Clean Commit History

Git: Rebase vs Merge - Choosing the Right Strategy

Git: Rebase vs Merge - Choosing the Right Strategy

Git: Fix Old Stash Changes Reapplying Because pop Didn't Drop It

Git: Fix Old Stash Changes Reapplying Because pop Didn't Drop It

Views: 7
Found this useful? Share it
XLinkedInWhatsApp

Post navigation

Git: Fix a Worktree Blocking a Branch Delete It Doesn’t Need
Ajax: Fix an Aborted Request Still Triggering Its Success Callback

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 996 views
  3. 03Get the User Name and Domain Name from an Email Address in SQL 995 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# 866 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 @ 629 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