Daily Shaarli

All links of one day in a single page.

March 22, 2021

Find the commit that introduced a bug in your code: how to use git bisect in 7 steps – flavia bastos
thumbnail

git bisect usage:

git bisect start > puts you into bisect mode

git bisect bad <commitref|HEAD> > signal to git the commit where things definitely don't work right anymore (mostly HEAD)

git bisect good <commitref|HEAD> > signal to git the commit where things definitely did work right still (can be any number of commits back).

You will no be put into a special bisect inspection mode and git will checkout various commits in a divide and conquer manner for you to declare their status.

git bisect good|bad > After checking the state of the app/running tests/whatever, declare the commit as working or not-working. Git will then move you to the next commit until you find the right one introducing the bug.

git bisect reset > get out of bisect mode