What does it mean when a cat hits you?
Headbutting is a way for cats to mark you with pheromones and bond with you. However, sometimes headbutting can be a way for cats to seek attention. As a general rule, cats like to be scratched under the chin and on the head, so a cat may just be presenting their head to you for some attention and good scratches.
The most common reason that cats bite their owners isn't that they have an aggressive cat, it's because they are trying to play! While sharp teeth or claws may not feel very “playful” to you, hunting behavior equals play behavior for your kitty. This means stalking, pouncing, biting, and kicking.
The cat begs for attention and loves the petting, but then bites you after only a few strokes. These cats use the “leave me alone” bite to stop interactions such as petting, being lifted or approached, or being moved from a favorite perch. It's a very common behavior in cats, but you can work with your pet to stop it.
At the very least they tend to make the cat wary of your approach. Instead, whenever the cat begins to swat or play attack, immediately stop the play by walking away or by using some non-physical form of punishment such as a water sprayer, can of compressed air, cap gun, hand held alarm or perhaps a loud hiss.
Cats punch each other because they are playing or they are defending themselves. Punching is a mild aggressive behavior and signals the cat is experiencing fear & discomfort. Cats also show dominance through it.
Speaking of games, cats swatting at other cats (or you) is their idea of a good time. It can also be a cat's way of asserting itself as the dominant feline. As long as there's no hissing, clawing, or other aggressive behavior, you don't really have to worry about it.
Many cats exhibit what behaviourists call “petting-induced aggression,” an instinctive reaction to something they find unpleasant, even painful. Compared to dogs, cats are generally less tolerant of petting. When, where and how long cats can be touched before they become overstimulated vary from cat to cat.
So, just as you suspected, one of the main reasons that cats like to rub their head against you is to show affection and there is even a name for this behaviour – 'bunting'. Cats 'bunt' primarily as a way of bonding, and they do this not only to you and other humans but also with other cats and even dogs.
Cats typically perform this bunny-kick move when engaging in aggressive play or when they're attacking their prey (i.e., your arm).
Some kitty lovers call this a 'love bite', others call it petting aggression. It's a controversial subject but it's believed that if your cat suddenly bites you for no apparent reason, it could be because they are being overstimulated by the constant stroking - which you thought they were enjoying!
Do cats feel protective of their owners?
Cats are often stereotyped as standoffish and aloof, even to the people who love them most, but the truth is that cats can be just as protective of their people as dogs are of theirs. Put simply, cats love their family and their family loves them right back.
Playful, energetic cats may slap each other as in invitation to play. Cats that are inviting play by slapping will have body language fitting a playful cat. Their whiskers will be forward and their attention given to the situation at hand.

Never hold down, shake or hit your cat. Physically harming your cat can actually make the situation worse and cause her to lash out or become withdrawn. Also, cats have a hard time associating the physical punishment with the bad behavior, so you're not actually training her to stop doing it.
Yes, they can! If you think your cat is upset with you, give them some space to calm down and give it some time. The best thing you can do is back off and show them that you recognize that you've hurt them and that you're going to stop doing what you were doing.
Never hit or yell at your cat for biting.
This will only reinforce in her mind that hands cause pain or that petting isn't enjoyable and she will become even less tolerant of handling. She could also become afraid of you.
Contrary to popular belief, hissing is not an aggressive behavior, nor is it generally exhibited by an aggressive cat. Hissing is a defensive gesture. It is almost always exhibited by a cat that feels victimized, antagonized, or threatened in some way. Hissing is often a way to avoid a physical confrontation.
Your cat may move their head or body away from you. Your cat may sharply or quickly turn their head towards your face or hands (usually as a reaction to you touching them somewhere they're not keen on). Your cat may approach you, interact, and then quickly walk away, potentially repeating this cycle multiple times.
Famously independent, sometimes falsely assumed to be immune to feelings, cats are in truth super-sensitive to emotions, sound, and stress. Perhaps because felines lack the eager-to-please openness of their canine colleagues, humans overlook the big and small ways they can break a cat's spirit.
Cats head bump each other and others to create a communal smell because cats recognize each other by smell before anything else. What your cat is really trying to tell you is, “Hey, I want you to smell a little more like me but don't worry I still love you!” How is this done?