Turn your head/body sideways.
Stand completely still so that you do not make eye contact.
Do NOT scream, move quickly, run away or wave wildly at it.
If the dog is not insane or rabid, most will recognize that as non-confrontational body language and lose interest.
Sometimes, just yelling NO!, DOWN! or SIT! will confuse/defuse an otherwise obedience trained dog.
“Alpha” body language is ALL about looking like you don’t care, aren’t impressed and in control enough to disregard a subordinate’s stupid behavior.
Unless, of course, some handler has sicced a trained dog on you.
Then, all bets are off and you’re screwed.
OK. Next time a dog like does that I will put your advice to action. May I ask another question? Does it mean anything if a dog growls rather than barks at a human?