(3) باب نَدْبِ مَنْ حَلَفَ يَمِينًا فَرَأَى غَيْرَهَا خَيْرًا مِنْهَا أَنْ يَأْتِيَ الَّذِي هُوَ خَيْرٌ وَيُكَفِّرَ عَنْ يَمِينِهِ
'Adi reported Allah's Messenger (ﷺ) as saying:
When anyone amongst you takes an oath, but he finds (something) better than that he should expiate (the breaking of the oath), and do that which is better.
Reference: Sahih Muslim 1651 c
In-book reference: Book 27, Hadith 24
USC-MSA web (English) reference(deprecated numbering scheme): Book 15, Hadith 4058
Read hadith from the major collections in the app, with prayer times and a Qibla compass. Free.