← Sahih al-Bukhari
Sahih al-Bukhari · Hadith #3780 · Merits of the Helpers in Madinah (Ansaar)

Narrated `Abdullah bin `Abbas:

حَدَّثَنَا عَبْدَانُ، حَدَّثَنَا عَبْدُ اللَّهِ، عَنْ يُونُسَ، عَنِ الزُّهْرِيِّ، قَالَ أَخْبَرَنِي عُبَيْدُ اللَّهِ بْنُ عَبْدِ اللَّهِ بْنِ عُتْبَةَ، عَنْ عَبْدِ اللَّهِ بْنِ عَبَّاسٍ ـ رضى الله عنهما ـ أَنَّ النَّبِيَّ صلى الله عليه وسلم كَانَ يَسْدِلُ شَعْرَهُ، وَكَانَ الْمُشْرِكُونَ يَفْرُقُونَ رُءُوسَهُمْ، وَكَانَ أَهْلُ الْكِتَابِ يَسْدِلُونَ رُءُوسَهُمْ، وَكَانَ النَّبِيُّ صلى الله عليه وسلم يُحِبُّ مُوَافَقَةَ أَهْلِ الْكِتَابِ فِيمَا لَمْ يُؤْمَرْ فِيهِ بِشَىْءٍ، ثُمَّ فَرَقَ النَّبِيُّ صلى الله عليه وسلم رَأْسَهُ‏.‏

The Prophet (ﷺ) used to keep his hair falling loose while the pagans used to part their hair, and the People
of the Scriptures used to keep their hair falling loose, and the Prophet (ﷺ) liked to follow the People of the
Scriptures in matters about which he had not been instructed differently, but later on the Prophet (ﷺ)
started parting his hair.