I saw the Messenger of Allah ﷺ with people following him, so I followed him along with them. Suddenly the people rushed forward, and I lagged behind. The Messenger of Allah ﷺ came up to me and struck me a blow, either with a palm-branch, a stick, a tooth-stick, or something else he had with him. By Allah, it did not hurt me.I spent that night, and I said to myself, "The Messenger of Allah ﷺ did not strike me except for something Allah had taught him about me." I told myself that I would go to the Messenger of Allah ﷺ when morning came.Then Jibreel descended upon the Prophet ﷺ and said, "You are a shepherd, so do not break the horns of your flock."When we had prayed the morning prayer, or he said when morning came, the Messenger of Allah ﷺ said, "O Allah, there are people who follow me, and it does not please me that they follow me. O Allah, whomever I have struck or reviled, make it for him an expiation and a reward," or he said, "forgiveness and mercy," or as he said.
حدثنا عارم حدثنا معتمر بن سليمان عن أبيه حدثنا السميط عن أبي السوار حدثه
رأيت رسول الله ﷺ وأناس يتبعونه فأتبعته معهم قال ففجئني القوم يسعون قال وأبقى القوم قال فأتى علي رسول الله ﷺ فضربني ضربة إما بعسيب أو قضيب أو سواك وشيء كان معه قال فوالله ما أوجعني قال فبت بليلة قال أو قلت ما ضربني رسول الله ﷺ إلا لشيء علمه الله في قال وحدثتني نفسي أن آتي رسول الله ﷺ إذا أصبحت قال فنزل جبريل عليه السلام على النبي ﷺ فقال إنك راع لا تكسرن قرون رعيتك قال فلما صلينا الغداة أو قال صبحنا قال قال رسول الله ﷺ اللهم إن أناسا يتبعوني وإني لا يعجبني أن يتبعوني اللهم فمن ضربت أو سببت فاجعلها له كفارة وأجرا أو قال مغفرة ورحمة أو كما قال
Its isnad is sahih, and its narrators are trustworthy and well known. Sumayt is Ibn Umayr, and he is trustworthy, his hadith being found in Muslim. Haythami said in 9/407, "Its narrators are the narrators of the Sahih." This hadith has already been mentioned before with many different wordings. See 9050, 9764, 15731, 18485.