You’ve gotten some good advice already.
The WRONG thing t do is act scared or run. They see you as prey.
However — as CallMeJay has already said, a firm “NO!” will usually work, as dogs are domesticated and acclimated to take directions from people.
Being unafraid and talking in a kind, soothing voice as if it were your own beloved pet may calm a dog that’s angry but not actually charging yet. Ask it sweetly, ‘what’s wrong?” and speak with a quip of humor. They may continue to bark and stand their own ground but will not charge and act unsure.
Pepper Spray or a taizer-like device called a dazer will work. It would be really hard for me personally to permanently injure a dog—but you could. I mean, they have that horizntal spine and jaws/teeth that are protruded and vulnerable.
I wouldn’t stare a dog down or talk In a growly voice—because who knows that might trigger the wrong instinct and make them play the dominance/kill the leader act.
A firm NO—or treating it as your own pet and be calming, comforting and kind usually works for me. Another option is playing dogcatcher. If YOU pretend YOUR task at hand is capturing the dog (and acting calm and in control as a dogcatcher would) works for me and makes a dog retreat.
For some reason, the dumbest things about a dogs intellect is they don’t really understand size. If you approach with a branch or large object and pretend it is a weapon—especially something big like opening an umbrella— or like that flashlight or soda can will subdue them—they can easily be bluffed. But a firm “NO” and pretending to have the upper hand and a way to catch them or subdue them really works. Or sometimes, sweet baby talk like its your pet.
Don’t challenge a dog as another dog in a dogfight would—and don’t act like scared prey. You’re the “adult” and are there to take charge of the dog.