A few ideas..
Carry high value dog treats (sausage, ham, cheese) for your dog - and also to 'bomb' an incoming dog you are not sure on. Whilst this is unlikely to halt a dog hell bent on an attack, it might well stop a 'friendly but rude' approach turning into a dog fight.
Pop up umbrella - deployed toward the oncoming dog can provide enough shock/startle to stop them, allowing you to do a voice of doom SIT! which can work surprisingly well as its generally the first thing any dog is taught even if they're never taught anything else, or scatter food etc.
Rape alarm, can of compressed air, bite stop spray... YMMV but none are shockingly bad ideas.
Carry a stick, a walking type stick obviously, not a weapon.
However - ensure YOUR dog is comfortable with all these things deployed near them, because you could cause your own dog to bolt or you could cause them to redirect frustration/fear/aggression onto you (particularly if they're on a short lead so the only thing they can bite IS you..). I know many people will say 'my dog would never....' but the truth is, most dogs will if the situation is stressful enough.
If you have a little dog who can be carried, teach them to be picked up with a cue so they know its happening and don't fear it. Whilst picking a little dog up can trigger some dogs to jump up to investigate or snap at a smaller dog (they seem to sense the carried dog is vulnerable), its still likely to be safer. But it is safer still if your dog is not growling/barking/crying because they're scared of being picked up!
Plan where you walk - avoid narrow gaps/paths, tight spaces where you can't get some distance.
Avoid walking head on at another dog with yours on lead, these head on approaches forced by our pavements and short leads can trigger a spat or attack as the dogs come closer together because they're super unnatural. The dogs feel trapped, their options are limited, and its very easy for dogs to misread one anothers body language in this situation (particularly if the oncoming dog has a squashed up face, starey eyes etc, as part of their breed appearance). And of course some dogs are genuinely sending pretty hostile signals long before you come close to them, and their owners can be totally unaware of this.
Arc around, cross the road, get space, try to avoid the direct eye contact by distracting your dog.
If another dog does attack your dog unfortunately there is no sure fire guaranteed 'do this one thing and...' solution.
The most effective thing generally is to try and get a hold of the dogs (one person per dog) by collar and tail, choke out a dog that is clamped down on the other dog (or both if they both are) and avoid pulling, as that can really exacerbate damage.
When the clamped on dog (btw most dogs will do this in a fight, particularly if they're really nervous dogs. If they clamp down and don't let go, then their victim cannot get them. To let go, is to put themselves at risk so they try not to!) lets go, if you have the collar and tail you may be able to launch it backwards a fair distance - not something to do if someone has hold of the other dog but if you're trying to sort a situation with two dogs and just one of you, it may be (particularly if its over a fence or out of a door you can slam shut).
That is far easier said than done and of course puts you at risk of bites from either dog (yes yours will bite you, they won't even know its you).
If you can avoid yelling, screaming, kicking/hitting etc - great. Most people can't, its instinctive.
I've had to do these things a few times (very few fortunately but I have worked at some very dodgy rescue centres when I was much younger) and avoidance really IS the best policy.