In other words- walking on a loose leash.
This video quickly outines exercises to get your dog walking on a loose leash by your side. Put very basically FIRST you will teach the dog what you want them to do! And secondly, stop reinforcing them when they pull!
I demonstrate the exercise using a clicker, but if you do not have one, you can always use a verbal marker like yes etc. However you will get much faster and reliable results by using the clicker. If you hold the clicker in the same hand as the leash, and keep the treats in the other hand, you will find it easier to manage. Practice holding the leash, clicker, and treats when you do not have the dog attached to the leash yet, so you dont become overwhelmed.
A great book on loose leash walking, or how to stop your dog from pulling is-
My Dog Pulls. What Do I Do? by Turid Rugaas
You can get this book on www.dogwise.com and other places too. Its very short and has lots of pictures.
I would advise against using any forms of positive punishment when teaching any behavior, but especially leash walking, as startling or hurting a dog actually increases their stress hormones in their body causing the dog to be more hyperactive and more likely to become aroused and reactive towards other dogs and people (weather they want to greet them or not).
DO NOT DROP THE LEASH! I showed myself dropping the leash on a street with no cars/danger and another person there. This would happen during an emergency, if you trip or fumble. In no way do I support people who walk with their dogs off leash, you never can tell if a car will backfire, or who knows what, an earthquake etc with frighten your dog, and cause it to run into traffic. If you don’t like holding a leash, simply tie it to your waist like I do with my dogs. However walking in a safe place where dogs are allowed off leash is perfectly acceptable