Sahih al-Bukhari 3944
Narration text is preserved in its supplied Arabic and English. Translated interfaces and reading guides do not add narration translations in other languages.
حَدَّثَنَا عَبْدَانُ، حَدَّثَنَا عَبْدُ اللَّهِ، عَنْ يُونُسَ، عَنِ الزُّهْرِيِّ، قَالَ أَخْبَرَنِي عُبَيْدُ اللَّهِ بْنُ عَبْدِ اللَّهِ بْنِ عُتْبَةَ، عَنْ عَبْدِ اللَّهِ بْنِ عَبَّاسٍ ـ رضى الله عنهما ـ أَنَّ النَّبِيَّ صلى الله عليه وسلم كَانَ يَسْدِلُ شَعْرَهُ، وَكَانَ الْمُشْرِكُونَ يَفْرُقُونَ رُءُوسَهُمْ، وَكَانَ أَهْلُ الْكِتَابِ يَسْدِلُونَ رُءُوسَهُمْ، وَكَانَ النَّبِيُّ صلى الله عليه وسلم يُحِبُّ مُوَافَقَةَ أَهْلِ الْكِتَابِ فِيمَا لَمْ يُؤْمَرْ فِيهِ بِشَىْءٍ، ثُمَّ فَرَقَ النَّبِيُّ صلى الله عليه وسلم رَأْسَهُ.
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.
Full reference and source
Sahih al-Bukhari 3944 In-book : Book 63, Hadith 169 USC-MSA web (English) : Vol. 5, Book 58, Hadith 280 (deprecated)
View source on Sunnah.com (opens in a new tab)