Bulugh al-Maram, Book 13, Hadith 1377 (English)

Narrated 'Abdur-Rahman bin Samura (RA): Allah's Messenger said: "When you swear an oath and then consider something else to be better than it, make atonement for your oath and do the thing that is better." [Agreed upon]. A wording of al-Bukhari has: "Do the thing that is better and make atonement for your oath." In a narration by Abu Dawud: "Make atonement for your oath, then do the thing that is better." [The chains of narrators of both Ahadith are Sahih (authentic)].

وَعَنْ عَبْدِ اَلرَّحْمَنِ بْنِ سَمُرَةٍ ‏- رضى الله عنه ‏- قَالَ: قَالَ رَسُولُ اَللَّهِ ‏- صلى الله عليه وسلم ‏-{ وَإِذَا حَلَفْتَ عَلَى يَمِينٍ, فَرَأَيْتُ غَيْرَهَا خَيْراً مِنْهَا, فَكَفِّرْ عَنْ يَمِينِكَ, وَائْتِ اَلَّذِي هُوَ خَيْرٌ" } مُتَّفَقٌ عَلَيْهِ 1‏.‏ وَفِي لَفْظٍ لِلْبُخَارِيِّ: { " فَائِت اَلَّذِي هُوَ خَيْرٌ, وَكَفِّرْ عَنْ يَمِينِكَ" } 2‏.‏ وَفِي رِوَايَةٍ لِأَبِي دَاوُدَ: { " فَكَفِّرْ عَنْ يَمِينِكَ, ثُمَّ اِئْتِ اَلَّذِي هُوَ خَيْرٌ" } وَإِسْنَادُهَا صَحِيحٌ 3‏.‏ ‏1 ‏- صحيح.‏ رواه البخاري ( 6622 )‏، ومسلم ( 1652 )‏.‏‏2 ‏- البخاري ( 6722 )‏.‏ ‏3 ‏- صحيح.‏ أبو داود ( 3278 )‏.‏

sunnah.com

also referenced under: Book 13, Hadith 4 (In-Book)