My son started doing this as soon as he could sit up. The doctor's advice was to make sure he was in a safe place (we had cement floors with no padding, so that required moving him to his crib) and then ignoring the behavior. She also said to be glad he wasn't one who threw up or held his breath till he passed out when he's upset. LOL...
Many kids go through this kind of behavior, and generally it's because they get a reaction. She can tell if it hurts her head. Just make sure she's somewhere safe and then walk away. And if you can see it coming, do what you can to distract and redirect her before she gets to the tantrum point.
Until she is near 3, most "discipline" (time out, etc) goes over most kids' heads. They just don't get that time out was because they did something wrong, so don't do it again. Through the 2's, the best bet is to catch her in the act (or before) and redirect her to something that is okay to do. You can set rules like no hair pulling and no hitting, and tell her the rules as you stop the behavior. And it's perfectly ok to put her in her crib, playpen, or room and walk away to give you both a cooling down period.
Kids generally don't understand "right" and "wrong" until school age. State the rules as a definite - "no hitting" - and don't feel you always need to be explaining why (if they ask, go ahead and give a simple explanation). But DO NOT let it become a negotiation of the rule. The rule stands as is (you can maintain that part even when they are a teen - this is the rule, no negotiating). As they get to school age, you can start teching more of the reason behind the rule and begin shifting the focus from just keeping the rules to making good choices, but it is a process that will evolve over the years and, like I said, sometimes in the teen years you have to go back to the inflexible rule (decide in advance which ones are inflexible)