The Messenger of Allah ﷺ said, "May Allah have mercy on those who shave their heads."The companions said, "Messenger of Allah, and those who shorten their hair?"He said, "May Allah have mercy on those who shave their heads."On the fourth time, he added, "And those who shorten their hair."
حدثنا يحيى عن عبيد الله أخبرني نافع
قال رسول الله ﷺ يرحم الله المحلقين قالوا يا رسول الله والمقصرين قال يرحم الله المحلقين قال في الرابعة والمقصرين
Its isnad is sahih. Malik related it in Muwatta 1:352 from Nafi from Ibn Umar, with similar wording. Abu Dawud related it in 2:149 by way of Malik, and Munziri said, Bukhari and Muslim also related it. Its meaning has already been given, both briefly and at length, in the hadith of Ibn Abbas, 1859 and 3311.