كتاب الحج
15  
The Book of Pilgrimage
(55)
Chapter: Shaving the head is preferrable to cutting the hair, although cutting the hair is permissible
(55)
باب تَفْضِيلِ الْحَلْقِ عَلَى التَّقْصِيرِ وَجَوَازِ التَّقْصِيرِ ‏‏
Sahih Muslim 1303

Yahya b. al-Husain reported on the authority of his grandfather that Allah's Apostle (ﷺ) invoked blessing on the occasion of the Farewell Pilgrimage three times for those who got their heads shaved and once for those who got their hair clipped. In the narration transmitted by Waki' there is no mention of the Farewell Pilgrimage.

حَدَّثَنَا أَبُو بَكْرِ بْنُ أَبِي شَيْبَةَ، حَدَّثَنَا وَكِيعٌ، وَأَبُو دَاوُدَ الطَّيَالِسِيُّ عَنْ شُعْبَةَ، عَنْ يَحْيَى بْنِ الْحُصَيْنِ، عَنْ جَدَّتِهِ، أَنَّهَا سَمِعَتِ النَّبِيَّ صلى الله عليه وسلم فِي حَجَّةِ الْوَدَاعِ دَعَا لِلْمُحَلِّقِينَ ثَلاَثًا وَلِلْمُقَصِّرِينَ مَرَّةً ‏.‏ وَلَمْ يَقُلْ وَكِيعٌ فِي حَجَّةِ الْوَدَاعِ ‏.‏
Reference : Sahih Muslim 1303
In-book reference : Book 15, Hadith 354
USC-MSA web (English) reference : Book 7, Hadith 2989
  (deprecated numbering scheme)