If possible, quickly glance to see which side your attacker is coming from.
Step into your attacker.
Place one arm on top of your attacker's shoulder to create a lever.
Place your free hand on the attacker's shoulder, on top of your hand that's already there, and push down forcefully using both hands.
When the attacker first grabs your hair, don't assume a fighting stance immediately. You don't want to give away that you will be able to defend yourself.
If you're unsure or uncomfortable with escaping from a hair pull, wait until your attacker moves closer, and use a self defense skill you feel more comfortable with.