What situation do you have in mind? git bisect is a pretty simple idea in general. You hold the first and second reference and then update one of them to the new "middle" after testing it. The completely generalised implementation is trivial, so it's hard to tell what you intend to do.