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