A quick squirt of the water bottle usually does it for me. If not, stopping will get rid of most of them (nothing to chase etc etc), but be sure to position your bike between you and the dog if you take the latter option.
__________________
I am clinically insane. I am proud of it.
That is all.