← 返回命令列表

Linux command

git-bisect 命令

文件

复制后可按需替换文件名、目录或参数。

常用示例

Start bisecting

git bisect start

Mark current as bad

git bisect bad

Mark known good commit

git bisect good [commit]

Reset bisect

git bisect reset

Run automated test

git bisect run [test-script.sh]

说明

git bisect uses binary search to find the commit that introduced a bug. Given a known good and bad commit, it systematically narrows down the range until finding the exact commit. The process works by checking out commits halfway between good and bad, testing, and marking the result. This logarithmic search reduces the number of commits to test dramatically -- finding a bug among 1000 commits requires only about 10 tests. The run subcommand fully automates bisection with a test script that returns exit code 0 for good and non-zero for bad, making it possible to find regressions without manual intervention.

参数

start
Begin bisection.
bad _COMMIT_
Mark commit as bad.
good _COMMIT_
Mark commit as good.
reset
End bisection session.
run _SCRIPT_
Automate with test script.
skip
Skip untestable commit.
log
Show bisect log.
--help
Display help information.

FAQ

What is the git-bisect command used for?

git bisect uses binary search to find the commit that introduced a bug. Given a known good and bad commit, it systematically narrows down the range until finding the exact commit. The process works by checking out commits halfway between good and bad, testing, and marking the result. This logarithmic search reduces the number of commits to test dramatically -- finding a bug among 1000 commits requires only about 10 tests. The run subcommand fully automates bisection with a test script that returns exit code 0 for good and non-zero for bad, making it possible to find regressions without manual intervention.

How do I run a basic git-bisect example?

Run `git bisect start` in a terminal, then adjust file names, paths, flags, or remote targets for your system.

What does start do in git-bisect?

Begin bisection.