The Messenger of Allah ﷺ said, "Whoever leaves a hair's spot unwashed during the major ritual bath, such and such will be done to him with the Fire."Ali said, "From that time on, I treated my head as an enemy, three times over." And he used to crop his hair short.
حدثنا موسى بن إسمعيل حدثنا حماد أخبرنا عطاء بن السائب عن زاذان
أن رسول الله ﷺ قال من ترك موضع شعرة من جنابة لم يغسلها فعل بها كذا وكذا من النار قال علي فمن ثم عاديت رأسي ثلاثا وكان يجز شعره
Its isnad is hasan. Ibn Majah related it in the Book of Purification, chapter "Under every hair is impurity," hadith no. 599, from the hadith of Hammad bin Salama, with this wording. Al-Hafiz graded it sahih in Talkhis Habir 1/142, and made some remarks on it.