عربي
News
●E-invoicing: the last date to connect for wave 25 is February 1, 2027●WhatsApp Business: service messages are paid after 1,000 free per month●Salla acquires Paylink to strengthen payment solutions for merchants●Google launches a Gemini agent for businesses first, then consumers●Hostinger's White Friday deals continue until December 14

Find the commit that broke a test with git bisect

Mark a known good and bad version, then narrow the interval in an isolated checkout.

The problem

A product-preview test passed in the last release and fails today. Dozens of commits sit between those releases. Walking them one by one takes time. Use a reproducible test to search the history.

The tool

git bisect applies binary search between a known good and known bad version. Run the same check at each selected commit and mark the outcome.

The steps

  1. Begin in a clean, isolated checkout. Record the preview command and remove dependencies on today's date or a changing database.
  2. Confirm the test passes at an older tag and fails at the current version. Record both identifiers instead of assuming the older tag is good.
  3. Run git bisect start, followed by git bisect bad HEAD while HEAD is the bad version and git bisect good v1.3.0 if you verified that tag.
  4. On each selected version, run the same test. Mark git bisect good for a pass and git bisect bad for the specific regression.
  5. Use git bisect skip if an unrelated build problem makes the version untestable. Record the reason. Skips near the boundary can leave more than one candidate.
  6. Record the indicated change, compare it with its relevant parent and run git bisect reset to return. Include the test command and outcome in the issue.

The real cost

Git includes bisect. Most cost comes from rerunning the check across differing dependencies, so isolate the smallest deterministic test.

The free alternative

For two adjacent changes, manual comparison might be quicker. A wider range makes a binary search useful.

Notes

  • We have not tried these steps ourselves yet. They are based on the official docs. Button names may change. If your interface differs, follow the docs.
  • The resulting commit is a starting point for investigation. Confirm that its behavior explains the reported symptoms.
  • Keep old revisions away from production data. Use a fixture and a distinct working directory.

Sources

  1. git-scm.com

Did you like this guide?

The weekly newsletter is being prepared. Leave your email and we'll send it when it launches.

We use your email only to send the newsletter. Privacy policy