Sunan Ibn Majah, Book 25, Hadith 162 (Ibn Majah 3045)

It was narrated from Abu Hurairah that the Messenger of Allah (ﷺ) said:

“O Allah, forgive those who shave (their heads).” They said: “O Messenger of Allah, and those who cut (their hair)?’ He said; “O Allah, forgive those who shave (their heads),” three times. They said: “O Messenger of Allah, and those who cut (their hair)?” He said: “And those who cut (their hair).”