What does the command git bisect do?

What does the command git bisect do?

a) Helps find the commit that introduced a bug
b) Splits a commit into multiple parts
c) Creates a new commit
d) Shows the differences between two commits

Answer:

a) Helps find the commit that introduced a bug

Explanation:

The git bisect command helps you find the commit that introduced a bug by performing a binary search through the commit history. It repeatedly checks for bad commits by asking you to mark them as “good” or “bad” until the problematic commit is identified.

For example, running git bisect start initiates the bisect process, and Git will guide you through checking each commit in the search range.

This is a powerful debugging tool that allows you to quickly locate the commit where an issue was introduced.

Reference:

Top 100 Git and GitHub MCQ Questions and Answers

Scroll to Top