كتاب الأمور المنهي عنها
17  
The Book of the Prohibited actions
(316)
Chapter: Desirability of Expiating the Oath taken by a Person who afterwards Breaks it for a better Alternative
(316)
- باب ندب من حلف على يمين فرأى غيرها خيرًا منها أن يفعل ذلك المحلوف عليه ثم يكفر عن يمينه
Riyad as-Salihin 1716
Abu Hurairah (May Allah be pleased with him) said:
The Messenger of Allah (ﷺ) said, "When you swear an oath and consider something else to be better than it, make expiation for your oath and do the thing that is better."

[Muslim].
وعن أبي هريرة رضي الله عنه أن رسول الله صلى الله عليه وسلم قال‏:‏ ‏ "‏من حلف على يمين، فرأى غيرها خيرًا منها، فليكفر عن يمينه، وليفعل الذي هو خير‏"‏ ‏(‏‏(‏رواه مسلم‏)‏‏)‏‏.‏
Reference : Riyad as-Salihin 1716
In-book reference : Book 17, Hadith 206