The Messenger of Allah ﷺ threw the pebbles at Jamrat al-Uqba, then went to the sacrificial animals and slaughtered them. The barber was seated, and he gestured with his hand toward his head. The barber shaved the right side, and the Prophet ﷺ distributed the hair among those near him. Then he said, "Shave the other side." He then asked, "Where is Abu Talha?" and gave it to him.
أن رسول الله ﷺ رمى جمرة العقبة، ثم انصرف إلى البدن فنحرها، والحجام جالس وقال بيده عن رأسه، فحلق شقه الأيمن فقسمه فيمن يليه، ثم قال: اخلق الشق الآخر فقال: أين أبو طلحة؟ فأعطاه إياه.
Muslim narrated it in Hajj (1305) through several chains from Hisham (that is, Dastawai), from Muhammad bin Sirin, from Anas bin Malik, and he mentioned it.Bukhari narrated it in Wudu (171) through the route of Ibn Awn, from Ibn Sirin, with the same chain, in an abridged form with the wording, "When the Messenger of Allah ﷺ shaved his head, Abu Talha was the first to take some of his hair."