Al-Ilmam bi-Ahadith al-Ahkam 636
وَعَن نَافِع أَن عبد الله بن عمر قَالَ: " حلق رَسُول الله ﷺ وحلقت طَائِفَة من أَصْحَابه، وَقصر بَعضهم، قَالَ عبد الله: إِن رَسُول الله ﷺ قَالَ: " يرحم الله المحلقين، مرّة أَو مرَّتَيْنِ " ثمَّ قَالَ: والمقصرين ". مُتَّفق عَلَيْهِ، وَاللَّفْظ لمُسلم .
From Nafiʿ that ʿAbdullah ibn ʿUmar said: "The Messenger of Allah ﷺ shaved his head, and a group of his Companions shaved, and some of them cut [their hair] short." ʿAbdullah said: The Messenger of Allah ﷺ said: "May Allah have mercy on those who shave," once or twice, then he said: "And those who cut short." Agreed upon, and the wording is Muslim's.