T.C.
He doesn't understand that it hurts, but it's totally fine (and good) to grab his hands and say "no" and redirect him. It won't work to discipline him at this age. He doesn't understand, but he can be distracted and always receive a "no" when he does it. I think I saw someone mention pull your hair back. That is a great suggestion! I've done that often with my son.