كتاب الحج
15  
The Book of Pilgrimage
(57)
Chapter: It is permissible to offer the sacrifice before stoning the Jamrah, or to shave before offering the sacrifice or stoning the Jamrah, or to perform Tawaf before any of them
(57)
باب مَنْ حَلَقَ قَبْلَ النَّحْرِ أَوْ نَحَرَ قَبْلَ الرَّمْىِ ‏‏
Sahih Muslim 1306 a

Abdullah b. 'Amr b. al-'As said that Allah's Messenger (ﷺ) stopped during the Farewell Pilgrimage at Mina for people who had something to ask. A man came and said:

Messenger of Allah, being ignorant. I shaved before sacrificing, whereupon he (the Holy Prophet) said: Now sacrifice (the animal) and there is no harm (for you). Then another man came and he said: Messenger of Allah, being ignorant, I sacrificed before throwing the pebbles, whereupon he (the Holy Prophet) said: (Now) throw the pebbles, and there is no harm (for you). Allah's Messenger (ﷺ) was not asked about anything which had been done before or after (its proper time) but he said: Do it, and no harm is there (for you).
حَدَّثَنَا يَحْيَى بْنُ يَحْيَى، قَالَ قَرَأْتُ عَلَى مَالِكٍ عَنِ ابْنِ شِهَابٍ، عَنْ عِيسَى بْنِ، طَلْحَةَ بْنِ عُبَيْدِ اللَّهِ عَنْ عَبْدِ اللَّهِ بْنِ عَمْرِو بْنِ الْعَاصِ، قَالَ وَقَفَ رَسُولُ اللَّهِ صلى الله عليه وسلم فِي حَجَّةِ الْوَدَاعِ بِمِنًى لِلنَّاسِ يَسْأَلُونَهُ فَجَاءَ رَجُلٌ فَقَالَ يَا رَسُولَ اللَّهِ لَمْ أَشْعُرْ فَحَلَقْتُ قَبْلَ أَنْ أَنْحَرَ ‏.‏ فَقَالَ ‏"‏ اذْبَحْ وَلاَ حَرَجَ ‏"‏ ‏.‏ ثُمَّ جَاءَهُ رَجُلٌ آخَرُ فَقَالَ يَا رَسُولَ اللَّهِ لَمْ أَشْعُرْ فَنَحَرْتُ قَبْلَ أَنْ أَرْمِيَ فَقَالَ ‏"‏ ارْمِ وَلاَ حَرَجَ ‏"‏ ‏.‏ قَالَ فَمَا سُئِلَ رَسُولُ اللَّهِ صلى الله عليه وسلم عَنْ شَىْءٍ قُدِّمَ وَلاَ أُخِّرَ إِلاَّ قَالَ ‏"‏ افْعَلْ وَلاَ حَرَجَ ‏"‏ ‏.‏
Reference : Sahih Muslim 1306a
In-book reference : Book 15, Hadith 360
USC-MSA web (English) reference : Book 7, Hadith 2995
  (deprecated numbering scheme)