My DD used to hit me (and only me) until about 2.6 (now 2.9). I tried everything, timeout, reasoning, talking, shouting, turning off TV, not going to the places that seemed to set her off. In the end I just ignored it and jumped out of the way quickly if I saw her planning to hit me.
I would go into another room and pick up a magazine/book and be 150% interested in it or went to the loo and locked the door for a few mins or went to hang out imaginary (or real!) washing on the line. By withdrawing ANY audience and totally ignoring even if she kept on and on hitting (which too all my patience and then some) she eventually gave up.
If she hit another child I would remove her immediately, put her as calmly as I could in timeout and make a big show of playing with the other child, then after a few mins ensure she apologised or threaten to leave. I did leave a few coffee mornings with her screaming in tow as she had hit and refused to 'say sorry' (as much as they can at that age). She quickly seemed to get the message on that one.
Now if she raises her hand to hit I only have to put on my stern face and say in a very deep low voice 'don't hit' and she usually sulks walks away, then returns minutes later for a cuddle.
It used to make me mad, I would get upset and shout and send her to timeout but this was the audience she wanted, and knew how to get a rise out of me. The more I said 'don't hit' the more she did it. By removing 'me' she lost the battle, would throw herself on the floor in a silent sulk. I would merely step over her and make a coffee.
Now, if I could get her to put clothes on and go to bed I would be really happy!