Git Bisect: finding where and when something stopped working or started failing

Git Bisect: finding where and when something stopped working or started failing

Find the commit where the things are working correctly:

in my case: 5b2f156 or the whole commit 5b2f156e43e25f71df55bbd0bc887662c48937a59

Find the commit where the things are not working or are failing:

in my case: 66b6b6be43e25f71df55bd0bc887662c49937a59

Lets find the root of the problem:

git bisect start

specify the good commit

git bisect good 5b2f156

Specify the bad commit :(

git bisect bad 66b6b6be43e25f71df55bd0bc887662c49937a59

and now you are in the middle of the good and the bad commit and reload your page or run your program again and see if it is working of failing.

If it is working run the following command in your terminal:

git bisect good

If it is failing run the following command instead:

git bisect bad.

btw you are going to see a message something like:

Bisecting: 9 revisions left to test after this (roughly 4 steps)
[df348201bd5e63035e35fd1036b1a822d7e1c56d] Merge branch 'master' into features/searcher-implementation

Reload the page or run the program again and see what’s going on and repeat:

If it is working run the following command in your terminal:

git bisect good

If it is failing run the following command instead:

git bisect bad.

And you have to do same until you find the commit where the things started happening.

When you see that the revision number is zero that means and 0 steps that means that you have finished your git bisect and this is the commit you are looking for:

Bisecting: 0 revisions left to test after this (roughly 0 steps)

Dont forget to reset this changes to the repository

git bisect reset

that’s it as simple as that.

Peace
H.

No Comments

Post A Comment