It is narrated from Sayyiduna Ibn Abbas (may Allah be pleased with them both) that the Prophet (peace and blessings be upon him) first stoned the Jamrah Aqabah, then performed the sacrifice, then had his head shaved.
Hadith Referenceمسند احمد / ومن مسند بني هاشم / 2253
Hadith Gradingحکم دارالسلام:حسن لغيره، حجاج بن أرطاة مدلس، وقد عنعن