Inspection
Visual bisect
8 min read
Something worked in version v1.4.0 and no longer works on main. There are 200 commits between
the two. Bisect finds the first bad commit by binary search: at each step, Versora checks out
the commit in the middle of the range, you test it and say whether it's good (without the
problem) or bad (with the problem). The range is cut in half with each answer. With 200
commits, about 8 steps are enough.
Everything is done by git bisect itself, and the state stays in the repository just like on the
command line. A bisect started in the terminal shows up in Versora, and vice versa.
- A commit's menu (with no bisect in progress):
- Bisect: mark as bad…: the chosen commit is the bad one; the window asks for the good one;
- Bisect: mark as good…: the chosen commit is the good one; the window asks for the bad one.
- Palette (Ctrl+P): "Bisect: start…" ("Find the commit that introduced a problem"), which asks for both.
- Stash or commit your changes, if there are any. See the cautions below.
- Right-click the commit where the problem already exists (for example the tip of
main) and choose Bisect: mark as bad…. - In the Start bisect window, enter in Good commit a commit from before the problem: SHA,
tag or branch. Versora already suggests the nearest tag below the bad commit, for example
v1.4.0.- From the palette, the window has both fields: Bad commit (the problem exists), which comes filled in with the current branch, and Good commit (before the problem).
- Leave the other side empty to mark it later, from the graph.
- If you want to skip the commits inside merges, check Follow only the first parent (doesn't test commits inside merges).
- Click Start bisect. The notice "Bisect started. Test the checked-out commit and mark it good or bad in the bisect bar." appears, and the graph selects the commit under test.
| Option | What it does | Default |
|---|---|---|
| Good commit / Good commit (before the problem) | The commit without the problem. | The nearest tag below the bad one, when there is one |
| Bad commit / Bad commit (the problem exists) | The commit with the problem. | The current branch |
| Follow only the first parent (doesn't test commits inside merges) | Starts with --first-parent: only the commits on the main line are tested. Useful when the merged branches don't build on their own. | Unchecked |
With the bisect in progress, the bisect bar appears above the graph. The commit under test is checked out (in detached HEAD).
- Test the checked-out commit: run the app, the tests or reproduce the problem.
- In the bar, click:
- Good ("The problem doesn't happen in this commit (git bisect good)");
- Bad ("The problem happens in this commit (git bisect bad)");
- Skip ("This commit can't be tested (git bisect skip)"), when the commit doesn't build or can't be tested for some other reason.
- Versora checks out the next middle commit and updates the bar: "N suspects · ~N steps left" (the tooltip says "N commits could still be the first bad one").
- Repeat until the bar shows First bad commit. The notice says "First bad commit found: <sha> — <summary>", and the graph selects the commit.
- End the bisect (see below).
You can also mark any commit from the graph. Right-click it:
- Bisect: mark as good;
- Bisect: mark as bad;
- Bisect: skip this commit.
From the palette, the actions apply to the checked-out commit: "Bisect: mark the current commit as good", "Bisect: mark the current commit as bad" and "Bisect: skip the current commit".
| Badge | Meaning |
|---|---|
| good | "Bisect: marked good" |
| bad | "Bisect: marked bad" |
| skipped | "Bisect: skipped (couldn't be tested)" |
| testing | "Bisect: commit under test (checked out). Test it and mark it good or bad in the bisect bar." |
| 1st bad | "Bisect: the first bad commit — the problem started here" |
| possible | "Bisect: may be the first bad commit (only skipped commits are left)" |
The commits that could still be the first bad one are highlighted ("Bisect: could still be the first bad commit").
| Element | What it does |
|---|---|
| Bisect | Title. The tooltip says "Bisect following only the first parent" when it was started with that option. |
| Waiting | One side still needs to be marked: "A good commit is missing — one from before the problem appeared.", "The bad commit is missing — one where the problem shows up." or "Mark a bad commit and a good one.". The Mark bad… and Mark good… buttons open a SHA, tag or branch field. |
| Good, Bad, Skip | Mark the commit under test. |
| Automatic… | Opens the automatic bisect. |
| Steps (N) | Shows the list of commits already marked and how each one was marked. |
| Command output | Shows the output of the last automatic bisect. |
| End | "git bisect reset — goes back to <branch>". |
If a command can tell on its own whether the problem exists (a test, a script), Versora runs that command at each step and marks the commit by its exit code, without you having to test.
- Bisect bar: Automatic… ("Run a command at each step (git bisect run)").
- Palette: "Bisect: run a command at each step…" ("Automatic bisect (git bisect run)").
- With the bisect started and the good and bad commits marked, click Automatic….
- In the Automatic bisect window, type the Command, for example
npm test,cargo testor./build.sh && ./teste.sh. - Click Run. The bar shows Automatic, the command, "N steps done", "testing <commit>" and the steps left.
- Use Show output to follow the output live, and Hide output to hide it. Each step shows up as "Step N · <commit>" and ends with "→ good (exit code 0)", "→ bad (exit code 1)" or "→ skipped (exit code 125)".
- To stop, click Cancel in the bar, or use "Bisect: cancel the automatic run" in the palette.
The command runs in Git's shell (sh), in the repository folder, with no keyboard input. The
result comes from the exit code:
| Code | Result |
|---|---|
| 0 | The commit is good |
| 125 | Skip (this commit can't be tested) |
| 1 to 127, except 125 | The commit is bad |
| 128 or higher | Stops the automatic bisect |
git bisect start [--first-parent] <bad> <good>... --
git bisect good [<commit>] # Good
git bisect bad [<commit>] # Bad
git bisect skip [<commit>] # Skip
git bisect reset [<commit>] # End
In automatic mode, Versora runs your command at each step through a script in
.git/versora-bisect-run.sh, saves the output to .git/versora-bisect-run.log and marks the
commit with git bisect good, bad or skip, using the same codes as git bisect run. In the
activity log, each step appears as
git versora-bisect-passo "<command>". The script can be deleted afterward.
- Click End in the bar, or use "Bisect: end" in the palette ("Goes back to <branch>"), or Bisect: end… in a commit's menu after the result.
- With the first bad commit found, the bar offers:
- End and go back to <branch>: goes back to the branch the bisect started from;
- End and stay on this commit ("Ends the bisect and leaves a detached HEAD on the first bad commit").
- Confirm in End bisect: "End the bisect and go back to <branch>? This bisect's marks will be discarded." Click End bisect.
- The notice says "Bisect ended; back on <branch>." or "Bisect ended; HEAD at <sha>.".
Bisect is an operation in progress, and nothing in it goes into Ctrl+Z. To abandon it, use End, which goes back to the starting point and discards the marks. A wrong mark is fixed by ending and starting over.
- "Note: there are uncommitted changes. They're carried along to every commit tested and may get in the way of the test (or block the checkout). If you can, stash them first.": appears in the start window.
- "There are uncommitted changes in files that differ between the commits being tested. Stash them (or commit them) and try again.": git couldn't check out the next commit.
- "A <operation> is in progress. Finish or abort it before starting the bisect.": finish the merge, rebase or cherry-pick first.
- "Enter at least the bad or the good commit.": both fields were left empty.
- "The same commit can't be marked both good and bad.": choose different commits.
- "The bad commit comes before the good commit. Bisect looks for the first bad commit after a good one: check that the two aren't swapped.": swap the fields.
- "The commit marked bad (<sha>) is already reachable from a commit marked good: the marks look swapped. End the bisect and start over.": one mark contradicts another.
- "The common base of the good and the bad commit already has the problem: it was fixed somewhere between the base and the good commit.": the problem is older than the good commit suggests.
- No single result, with "Only skipped commits are left; the first bad one is one of these:": the skipped commits prevent a single answer. The bar lists the candidates, marked as possible in the graph.
- "A bisect is already in progress in this repository.": end the current one before starting another.
- "Couldn't go back to where the bisect started (the branch may have been deleted, or changes are blocking the checkout). End it by choosing another commit to stay on.": use End and stay on this commit.
- In automatic mode:
- "Mark a good and a bad commit before running the automatic command.";
- "The command must be a single line (use && or ; to chain commands).";
- "The command exited with code N on the very first step, which usually means it doesn't exist or can't be run: check its name and the PATH. It runs in Git's shell (sh), in the repository folder. No commit was marked.": codes 126 or 127 on the first step;
- "The command exited with code N, which stops the automatic bisect (this commit wasn't marked). Use 0 for good, 125 to skip the commit and 1 to 127 (except 125) for bad.";
- "Run canceled; the interrupted step wasn't marked. The bisect stays where it stopped: mark commits by hand, run the command again or end it.";
- "This bisect has already finished. End it to start another one.".
- "wait for the current operation" and "a <operation> is in progress": the bisect items in menus and in the palette are disabled with that reason.
Bisect has no preference of its own and no company policy key.
- Stash
- Activity log
- Line history
- Git documentation: git bisect (opens another site)