Sayyiduna Abdullah bin Umar (may Allah be pleased with them both) narrates from Hafsah (may Allah be pleased with her) that the Prophet (peace and blessings be upon him) matted his hair (talbid) during Hajj, and when he left the state of ihram, he shaved his head.
Hadith Referenceالمعجم الكبير للطبراني / مسند النساء / 19687