(3) باب نَدْبِ مَنْ حَلَفَ يَمِينًا فَرَأَى غَيْرَهَا خَيْرًا مِنْهَا أَنْ يَأْتِيَ الَّذِي هُوَ خَيْرٌ وَيُكَفِّرَ عَنْ يَمِينِهِ
Abu Huraira reported Allah's Messenger (ﷺ) as saying:
He who took an oath and (later on) found another thing better than that, he should do that which is better, and expiate for the vow (broken by him).
Reference: Sahih Muslim 1650 c
In-book reference: Book 27, Hadith 20
USC-MSA web (English) reference(deprecated numbering scheme): Book 15, Hadith 4054