When the Messenger of Allah ﷺ performed the ritual bath after major impurity, he would first wash his hands, then perform ablution as he would for prayer. After that, he would begin the bath by running his fingers through his hair, and once he was satisfied that the water had reached his scalp, he would pour water over his head three times. Then he would wash the rest of his body.
أخبرنا سويد بن نصر قال أنبأنا عبد الله عن هشام بن عروة عن أبيه
كان رسول الله ﷺ إذا اغتسل من الجنابة غسل يديه ثم توضأ وضوءه للصلاة ثم اغتسل ثم يخلل بيده شعره حتى إذا ظن أنه قد أروى بشرته أفاض عليه الماء ثلاث مرات ثم غسل سائر جسده
Bukhari narrated it in the chapter on ghusl, section "Working the water through the hair until, when he thought his skin was thoroughly wetted, he poured water over himself," hadith no. 272, from the report of Abdullah bin Mubarak. Muslim narrated it in the chapter on menstruation, section on the description of the ghusl for janaba, hadith no. 316, from the report of Hisham, with the same wording.