When the Prophet ﷺ threw the pebbles at Jamrat al-Aqaba and sacrificed his offering, he was shaved, and he gave the barber his payment.Sufyan once said, "He gave the barber the right side of his head, and he shaved it. The Prophet ﷺ then gave the hair to Abu Talha. Then he shaved the left side and gave that hair to the people."
حدثنا سفيان حدثنا هشام بن حسان
لما رمى النبي ﷺ جمرة العقبة ونحر هديه حجم وأعطى الحجام وقال سفيان مرة وأعطى الحالق شقه الأيمن فحلقه فأعطاه أبا طلحة ثم حلق الأيسر فأعطاه الناس
Its isnad is sahih. It is connected through the route of Anas, and mursal through the route of Ibn Sirin, who is Muhammad when unspecified. Muslim narrated the hadith in 2/947, no. 1305, in the book of Hajj, chapter on the explanation that the sunnah is on the day of sacrifice. Abu Dawud narrated it in 2/202, no. 1981, in the book of rites, chapter on shaving and trimming the hair. And Tirmidhi narrated it in 3/246, no. 912, in the book of Hajj, chapter on what has been said about which side of the head one should begin with, and he said, hasan sahih.