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." . 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." .
وَعَنْ اِبْنِ عُمَرَ رَضِيَ اَللَّهُ عَنْهُمَا; أَنَّ رَسُولَ اَللَّهِ - صلى الله عليه وسلم -قَالَ: {
"مَنْ حَلِفِ عَلَى يَمِينٍ فَقَالَ: إِنْ شَاءَ اَللَّهُ, فَلَا حِنْثَ عَلَيْهِ" } رَوَاهُ اَلْخَمْسَةُ 1 . وَصَحَّحَهُ اِبْنُ حِبَّانَ 2 .1 - كذا "بالأصلين" وأشار ناسخ "أ" في الهامش إلى نسخة: "أحمد والأربعة".2 - صحيح. رواه أحمد ( 2 / 10 )، وأبو داود ( 3261 )، والنسائي ( 7 / 25 )، والترمذي ( 1531 )، وابن ماجه ( 2105 )، وابن حبان ( 1184 ). قلت: اللفظ للترمذي؛ إلا أنه زاد: "فقد استثنى" بعد قوله: "إن شاء الله" ، وإلى هذه الزيادة دون الجملة الأخيرة رواه أبو داود. والنسائي وأحمد. وأما لفظ ابن حبان فهو: "من حلف فقال: إن شاء الله، لم يحنث" . ولفظ ابن ماجه: " من حلف واستثنى، إن شاء رجع، وإن شاء ترك، غير حانث" . وهو أيضا لبعضهم، وله ألفاظ أخرى، ذكرتها مفصلة مع طرقها في "الأصل".
Narrated Narrated Ibn 'Umar (RA):
"Allah's Messenger (ﷺ) said: "Whoever swears an oath, and then says: "If Allah Wills", he is not held accountable if he breaks it."
Narrated In a narration which is Marfu' (attributed to the Prophet) reported by Abu Dawud and an-Nasa'i from Abu Hurairah (RA) it has:
"Do not swear by your fathers, nor by your mothers, nor by the rivals (set up as equals with Allah); and do not swear by Allah except when you are speaking the truth."