The Messenger of Allah ﷺ said, "Whoever takes an oath and then sees that something else is better than it, let him do what is better and make expiation for his oath."
حدثنا عبد الرحمن بن مهدي حدثنا شعبة عن عمرو بن مرة قال سمعت عبد الله بن عمرو مولى الحسن بن علي يحدث
قال رسول الله ﷺ من حلف على يمين فرأى غيرها خيرا منها فليأت الذي هو خير وليكفر عن يمينه
Its isnad is sahih. Abdullah bin Amr, the freed slave of Hasan, is trustworthy and his hadith has been accepted. The hadith previously appeared at 18160.