DEV Community

Discussion on: Git Bisect is Easy (How to Initiate the Robot Uprising)

Collapse
 
matthewpersico profile image
Matthew O. Persico

But what if I am not trying to find the transition between a good and a bad state. What if I am trying to find some other change, like when we added some particular function?

Well, the "test" to execute would be 'git grep theFunctionName'. But the 'good' followed by 'bad' is exactly the opposite logic to use.

You can change the names of what you use to indicate the transition. In this case:

git bisect start --term-old=dne --term-new=exists
git bisect exists
git bisect dne someOldhash
git grep -q theFunctionName && git bisect exists || git bisect dne

Repeat the last command until you get output.

Collapse
 
jacobherrington profile image
Jacob Herrington (he/him)

Cool! Yeah this is a contrived example, but for people unfamiliar it's useful. The cool thing about git is that it can be used really creatively to solve problems like this really quickly.