Sahih al-Bukhari, Book 63, Hadith 169 (In-Book) ⓘ
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.
حَدَّثَنَا عَبْدَانُ، حَدَّثَنَا عَبْدُ اللَّهِ، عَنْ يُونُسَ، عَنِ الزُّهْرِيِّ، قَالَ أَخْبَرَنِي عُبَيْدُ اللَّهِ بْنُ عَبْدِ اللَّهِ بْنِ عُتْبَةَ، عَنْ عَبْدِ اللَّهِ بْنِ عَبَّاسٍ ـ رضى الله عنهما ـ أَنَّ النَّبِيَّ صلى الله عليه وسلم كَانَ يَسْدِلُ شَعْرَهُ، وَكَانَ الْمُشْرِكُونَ يَفْرُقُونَ رُءُوسَهُمْ، وَكَانَ أَهْلُ الْكِتَابِ يَسْدِلُونَ رُءُوسَهُمْ، وَكَانَ النَّبِيُّ صلى الله عليه وسلم يُحِبُّ مُوَافَقَةَ أَهْلِ الْكِتَابِ فِيمَا لَمْ يُؤْمَرْ فِيهِ بِشَىْءٍ، ثُمَّ فَرَقَ النَّبِيُّ صلى الله عليه وسلم رَأْسَهُ.
also referenced under: Hadith 3944 (DarusSalam) & Volume 5, Book 58, Hadith 280 (USC-MSA)