3

Have you ever used git bisect? If so, how did you use it? Did it help you find a problem which would otherwise be difficult to find? Story time, I guess?

top 3 comments
sorted by: hot top controversial new old
[-] sisyphean@programming.dev 1 points 2 years ago

I don’t use it often, but when I do it saves me hours.

For example, I used it recently in a large project that had no CI. The build failed, and I could find the first commit it failed on using bisect in a couple of minutes.

[-] jim@programming.dev 1 points 2 years ago

Story time:

There was a long data pipeline that produced wrong results. The wrong results were subtle but reproducible. Each run was about an hour long in dev, and there was no intermediate data set. It takes some input, runs for an hour, and produces an output.

The code was inherited and was a bit of a mess. Instead of digging through the code, I re-ran the pipeline through from about 6 months ago when we knew there was know bug. It was about 100+ commits since that time.

Mind you, the bug could've been anywhere in the codebase as far as I was concerned.

Took about a day of git bisect to narrow it down... to nothing. I found out that running code from the first commit from 6 months ago also produced incorrect data. Oops. That's weird though because the code was running correctly back then.

A few days of debugging later, and I eventually found the culprit: a dependency package got bumped a couple weeks back. Some sort of esoteric parser had a bug but didn't fail. It incorrectly parsed some data after the bump. Going back a version fixed the bug.

So yeah, git bisect killed about a day of my time.

[-] canpolat@programming.dev 1 points 2 years ago

Now that you know the problem, do you think there would have been a way where git bisect would have found the problem? I don't know how your dependencies are handled, but if they are part of the code base (like NuGet packages referenced from project files) then I would expect bisect to find the offending commit where the dependency is bumped?

this post was submitted on 25 Jun 2023
3 points (100.0% liked)

Git

2918 readers
1 users here now

Git is a free and open source distributed version control system designed to handle everything from small to very large projects with speed and efficiency.

Resources

Rules

  1. Follow programming.dev rules
  2. Be excellent to each other, no hostility towards users for any reason
  3. No spam of tools/companies/advertisements. It’s OK to post your own stuff part of the time, but the primary use of the community should not be self-promotion.

Git Logo by Jason Long is licensed under the Creative Commons Attribution 3.0 Unported License.

founded 2 years ago
MODERATORS