Optimize diffing two branches
Instead of building the list of all the commits of one and then iterating
through the other to see if it has commits shared with the first, we now
go through the commits on both branches one step at a time and check if
they have overlapping commits at each steps.