The Messenger of Allah [SAW] used to let his hair hang down (without a parting) and the Mushrikun used to part their hair. The Messenger of Allah [SAW] liked to act in accordance with the People of the Book, in matters where no specific command had been given to him. Then the Messenger of Allah [SAW] parted his hair after that. (Using translation from Nasāʾī 5238)
أَنَّ رَسُولَ اللهِ ﷺ كَانَ «يَسْدِلُ شَعْرُهُ وَكَانَ الْمُشْرِكُونَ يَفْرُقُونَ شُعُورَهُمْ وَكَانَ رَسُولُ اللهِ ﷺ يُحِبُّ مُوَافَقَةَ أَهْلِ الْكِتَابِ فِيمَا لَمْ يُؤْمَرْ فِيهِ بِشَيْءٍ ثُمَّ فَرَقَ رَسُولُ اللهِ ﷺ بَعْدَ ذَلِكَ أَرْسَلَهُ مَالِكٌ»