Sayyiduna Abdullah bin Abbas (may Allah be pleased with them both) says that the Prophet (peace and blessings be upon him) was asked during the Farewell Pilgrimage: I sacrificed before stoning. He (peace and blessings be upon him) gestured with his hand and said: "There is no harm." A man said: I shaved my head before sacrificing. He (peace and blessings be upon him) gestured with his hand and said: "There is no harm." That day, whatever he (peace and blessings be upon him) was asked about doing earlier or later, he (peace and blessings be upon him) gestured with his hand and said: "There is no harm."
Hadith Referenceالسنن الكبرى للبيهقي / كتاب الحج / 9625