Hongmu Notes

git bisect

Use a binary search to locate the commit that introduced the error. Git will automatically jump back and forth in the submission history, gradually narrowing the scope of issue submissions.

100% Browser local processing 0 Data upload

Common examples

Start a binary search session between a known problematic commit and a known good commit (usually older)

git bisect start {{问题提交}} {{正常提交}}

Each commit automatically selected by `git bisect` is tested and marked as "ok" or "problematic"

git bisect {{good|bad}}

When `git bisect` locates the issue submission, end the binary search session and return to the original branch

git bisect reset

Skipping a commit during a binary search (e.g. a commit that caused the test to fail due to other issues)

git bisect skip

Display the progress log of the current binary search

git bisect log

Tip: curly braces{{…}}It is the parameter that needs to be replaced (path, file name, etc.); the command is only executed in the local terminal, and this site does not save any input.

English original text comparison

Expand English instructions and examples (source tldr-pages)

Use binary search to find the commit that introduced a bug. Git automatically jumps back and forth in the commit graph to progressively narrow down the faulty commit. More information

Start a bisect session on a commit range bounded by a known buggy commit, and a known clean (typically older) one

git bisect start {{bad_commit}} {{good_commit}}

For each commit that `git bisect` selects, mark it as "bad" or "good" after testing it for the issue

git bisect {{good|bad}}

End the bisect session and return to the previous branch

git bisect reset

Skip a commit during a bisect (e.g. one that fails the tests due to a different issue)

git bisect skip

Start a bisect session considering only commits that modify a specific file or directory

git bisect start {{bad_commit}} {{good_commit}} -- {{path/to/file_or_directory}}

Automate the bisect process using a test script that `exit`s with 0 for "good" and non-zero for "bad"

git bisect run {{path/to/test_script}} {{optional_script_arguments}}

Display a log of what has been done so far

git bisect log

Show remaining candidate commits to be checked

git bisect visualize

command information

command namegit bisect
PurposeUse a binary search to locate the commit that introduced the error. Git will automatically jump back and forth in the submission history, gradually narrowing the scope of issue submissions.
Applicable platforms通用
Number of examples5 Article
Official documentationhttps://git-scm.com/docs/git-bisect
Data sourcetldr-pages(CC-BY-4.0)· Community Chinese Translation

FAQ

git bisect What does the command do?

Use a binary search to locate the commit that introduced the error. Git will automatically jump back and forth in the submission history, gradually narrowing the scope of issue submissions.

git bisect How to use it?

Pages listed by scene5Commonly used examples: Each example first explains the purpose, and then gives a complete command that can be directly copied (the parameters that need to be replaced are in the curly brackets).

git bisect What are the most commonly used operations?

Start a binary search session between a known problematic commit and a known good commit (usually older):git bisect start {{问题提交}} {{正常提交}}

What do the curly braces in the command mean?

curly braces{{…}}Indicates that you need to replace it with your own value, such as path and file name; square brackets for parameters with the same name (such as[-C|--directory]) indicates optional writing.