git bisect run <filepath>
This command lets you automate git bisect by running a test script at each candidate commit so Git can quickly find which commit introduced a problem without you checking each step manually.
This command uses git bisect's run mode, where run tells Git to execute a program or script at every step of the binary search, and <filepath> is the path to an executable script that decides if the current commit is good or bad by its exit code. The script at <filepath> must return exit code 0 when the commit is considered good, 1 (or any non‑zero except 125) when the commit is bad, and 125 if the script cannot test this commit (for example, the project does not build); Git uses these results to automatically mark commits as good or bad and move to the next midpoint. Before using this command, you still need to start a bisect session (for example with git bisect start, then git bisect bad and git bisect good <good-commit>), and when Git finishes, you typically end with git bisect reset to return to your original state.
You can vary how you use this command by changing <filepath> to different scripts, such as a small test script that runs npm test, mvn test, or a specific binary and then evaluates the result. Instead of git bisect run <filepath>, you can also pass a full command line like git bisect run ./test.sh --fast or git bisect run python ./check_bug.py, which works the same way but lets you include arguments; closely related manual variants include running git bisect good and git bisect bad yourself at each step instead of using run, or combining this command with git bisect log and git bisect replay to save and reapply a bisect session. This command also works well together with git bisect visualize to quickly inspect the region Git has narrowed down, and with build tools or CI test scripts that already exit with proper status codes so you can plug them in directly.
Examples:
git bisect run ./test_bug.shgit bisect run ./scripts/check-login.shgit bisect run ./gradlew testgit bisect run python ./tools/verify_error.py