Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

git bisect says Bisecting: a merge base must be tested

Tags:

I did a git bisect and got the result

Bisecting: a merge base must be tested [bbdaf1111eea5365c0c94d6045d6263aab718925] Fix display bug with main-stage 

How can I proceed?

like image 448
Alex Avatar asked Jul 14 '17 16:07

Alex


People also ask

What is bisecting in git?

git bisect help. This command uses a binary search algorithm to find which commit in your project's history introduced a bug. You use it by first telling it a "bad" commit that is known to contain the bug, and a "good" commit that is known to be before the bug was introduced.

How do I remove a bad commit in git bisect?

Use git log to check the previous commits. Use Git Bisect to find the commit in which line 2 is changed from 'b = 20' to 'b = 0.00000'. Remove the bad commit by using Git Revert. Leave the commit message as is.

How do you reset a bisect?

To do this first run git bisect reset , this will end your bisect session. Now you can start over by running git bisect start and then marking a good and bad commit, which then will start the iterative process of marking commits selected by bisect good or bad again.

What is git bisect how can you use it to determine the source of a regression bug?

The git bisect command is a fantastic tool that can help you determine which commit introduced the bug. A regression bug is a specific type of software bug that prevents a feature or software from working when it was working before the bug was introduced. Just remember, git bisect won't "fix" the broken commit for you.


2 Answers

This will happen if the given good and bad revision are not direct descendants of each other.

Let's assume a repository like this (using exemplary names for the commits):

* dffa2 good-commit * b38f4 a2 * cc19f a1 | * d1f17 bad-commit | * fbd1f b2 | * f66cc b1 |/ * 09f66 merge-base-commit 

What "merge base" means

As the message uses the term "merge base", it might be helpful to understand that term to understand the message. A "merge base" of two or more commits is the latest commit which is a parent of all of those commits.

Therefore if those commits would be merged, all changes between the "merge base" and those commits will be merged together. Every commit which is a parent of "merge base" is not relevant to the merge, it already is a parent of all involved commits.

Understanding the bisect

The described message will happen in a case like this:

$ git bisect start $ git bisect good good-commit $ git bisect bad bad-commit Bisecting: a merge base must be tested [09f66] merge-base-commit 

What bisecting does is to find the commit which introduced a problem (leading to a bad state), which in this case could lead to a problem:

Bug was not introduced between good-commit and bad-commit

Assume that the error existed in merge-base-commit. In this case it will not be possible to find the commit that introduced the bug in the difference between good-commit and bad-commit. Instead one of the commits a1, a2 and good-commit solves the problem, which is exactly what will happen if you decide the merge base to be bad:

$ git bisect bad The merge base merge-base-commit is bad. This means the bug has been fixed between 09f66 and [dffa2]. 

Problem was introduced between merge-base-commit and bad-commit

On the other hand if the merge base is good, the problem was introduced in b1, b2 or bad-commit. bisect will then continue between merge-base-commit and bad-commit, picking the commit in the middle between those commits and testing if that one is good:

$ git bisect good Bisecting: 0 revisions left to test after this (roughly 1 step) [fbd1f] b2 
like image 137
lucash Avatar answered Sep 20 '22 19:09

lucash


Let it run, it's normal if there are merges on the path that has to be bisected.

like image 35
eftshift0 Avatar answered Sep 21 '22 19:09

eftshift0