DevOps > Jobs 1 second ago

Can you please explain about Git bisect?

Can you please explain about Git bisect?

301 views . 1 answers . 0 likes . 0 shares Lakshmi Anusha 1 answers

Can you please explain about Git bisect?

I read few articales but not clear about it.

profilepic.png

Answers (1)


profilepic.png
Kapil Kapil Best Answer 1 year ago

The idea behind git bisect is to perform a binary search in the history to find a particular regression. Imagine that you have the following development history:

... --- 0 --- 1 --- 2 --- 3 --- 4* --- 5 --- current

You know that your program is not working properly at the current revision, and that it was working at the revision 0. So the regression was likely introduced in one of the commits 12345current.

You could try to check out each commit, build it, check if the regression is present or not. If there are a large number of commits, this can take a long time. This is a linear search. We can do better by doing a binary search. This is what the git bisect command does. At each step it tries to reduce the number of revisions that are potentially bad by half.

301 views . 0 shares