Children are smooth donkeys.
All children are donkeys.
Divert attention
Also, when he hits someone, it's best to divert his attention immediately. Two-year-olds haven't the ability to tell right from wrong yet. You just need to tell him properly. Too much discipline is useless.
Correct expression
Your attitude is very important, so you should pay attention to your expression. At this time, children are sometimes in a hurry because they are not fluent. Usually be careful not to let him worry too much. Once he is in a hurry, we should enlighten him and let him have a correct expression.