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)]. (RU)
Reference (RU): Bulugh al-Maram 1377 (RU)
In-book reference (RU): Book 13, Hadith 4 (RU)
English translation (RU): Book 13, Hadith 1377 (RU)