Sahih Muslim Book 7, Hadith Number 2996.
Chapter : Regarding one who shaves before offering the sacrifice or offers sacrifice before throwing (the stones at Jamra).
‘Abdullah b. ‘Amr b. al-‘As (Allah be pleased with them) reported: Allah’s Messenger (may peace be upon him) stopped while riding his camel and the people began to ask him. One of the inquirers said: Messenger of Allah, I did not know that pebbles should be thrown before sacrificing the animal, and by mistake I sacrificed the animal before throwing pebbles, whereupon Allah’s Messenger (may peace be upon him) said: (Now) throw pebbles and there is no harm in it. Then another(person) came saying: I did not know that the animal was to be sacrificed before shaving, but I got myself shaved before sacrificing the animal, whereupon he (the Holy Prophet) said: Sacrifice the animal (now) and there is no harm in it. He (the narrator) said: I did not hear that anything was asked on that day (shout a matter) which a person forgot and could not observe the sequence or anything like it either due to forgetfulness or ignorance, but Allah’s Messenger (may peace be upon him) said (about that): Do it; there is no harm in it.