No doubt adding my two cents isn't necessary but then being on here isn't either so...
I have several dogs on a some regular routes and have also had some novel dogs pop up at unexpected times. If riding with others, the first thing to do, is of course, hold your line (my wife almost took me out by swerving and almost stopping in a group ride).
If dog is beside you and you're going at a decent clip, a stern "No" usually is enough for them to hesitate. Even poorly behaved dogs often understand that enough to resolve the situation. Thankfully, this even worked for an unfamiliar german shepherd charging me from my front right, looking like he was loaded for bear. He was pretty impressive, totally quiet and a total bullet. Just as he got to me, I shouted "No, bad dog!" and he slammed the brakes on totally confused. Still wanted a piece of me (I think) but by the time his tiny dog brain recovered, I was far enough past him that I wasn't worth the chase.
I've got one large black lab mix that totally works the angles, and plots a very good intercept course for me. He's mouthed my ankle a couple of times so i think he's not vicious but I did pepper spray him to hopefully keep him from running out into the road after me (and he's watched me a couple of time since but no chase). The problem with pepper spray is that you need to have it ready and that only works for expected dogs. For unexpected dogs, for me things happen to fast for me to be fumbling around in my jersey pocket and i'd probably just come up with a gel for him.
I think getting off sounds a wee bit crazy. You'll have to slow and clip out and if you're doing this because your worried about a dog, then it seems that you're a bit vulnerable. So far, I've always been able to ride through the trouble (knock on wood).
There's a great little terrier on one ride that always bolts out after me. First time it happened, I'm riding along and I keep hearing this clicking. I'm thinking "Damn, why on earth is my bike making this sound?". Only after about 15 seconds of trimming my gears and looking around do i realize that its this little dog just tearing after me, about 3 ft behind me, murder in his eyes. Now, I try to give him a good "get 'em!" and not go too fast so he can get in a good chase.