Guy friend pulled my hair?

So I was talking to one of my friends and my other friend (who is a guy) came up behind me, grabbed my pony tail, pulled my head back so that I was looking at him. Then he said, “smile, be happy today”.
I’m so confused about this. He is normally a quiet person but also very confident.
What does this mean? Why would he do that?
(By the way he didn’t pull my hair hard, just enough to pull my head back)
Guy friend pulled my hair?
Post Opinion