Sahih Muslim
1962.01

Anas (b. Malik) reported Allah's Messenger (ﷺ) having said on the day of Nahr (Sacrifice):He who slaughtered (the animal as a sacrifice) before the ('Id) prayer. should repeat it (i. e. offer another animal). Thereupon a person stood up and said: Messenger of Allah, that is the day when meat is much desired, and he also made a mention of the need of his neighbour, and perhaps Allah's Messenger (ﷺ) attested it. He (the person who had sacrificed the animal before the 'Id prayer) said: I have a goat of less than one year of age with me and I like it more than two fleshy goats; should I offer it as a sacrifice? He permitted him to do so. He (the narrator) said: I do not know whether this permission was granted to anyone else besides him or not. Allah's Messenger (ﷺ) then turned towards two rams. and he slaughtered them, and the people' came to the goats and got them distributed amongst themselves (for offering them as sacrifice)

1962.02

Anas b. Malik reported that Allah's Messenger (ﷺ) offered the 'Id prayer and then delivered the sermon giving the command:He who slaughtered the animal before prayer should slaughter (another animal as a sacrifice). The rest of the hadith is the same

1962.03

Anas b. Malik reported:Allah's Messenger (ﷺ) addressed us on the day of 'Id al-Adha. He smelt the odour of flesh and he prohibited thern from slaughtering (the animals before the 'Id prayer), saying: He who slaughtered the animals (before the 'Id prayer) should do that again (as it is not valid as a sacrifice)