عَنْ اِبْنِ عُمَرَ رَضِيَ اَللَّهُ عَنْهُمَا, { عَنْ رَسُولِ اَللَّهِ ‏- صلى الله عليه وسلم ‏-أَنَّهُ أَدْرَكَ عُمَرَ بْنَ اَلْخَطَّابِ فِي رَكْبٍ, وَعُمَرَ يَحْلِفُ بِأَبِيهِ, فَنَادَاهُمْ رَسُولُ اَللَّهِ ‏- صلى الله عليه وسلم ‏-"أَلَا إِنَّ اَللَّهَ يَنْهَاكُمْ أَنْ تَحْلِفُوا بِآبَائِكُمْ, فَمَنْ كَانَ حَالِفاً فَلْيَحْلِفْ بِاَللَّهِ, أَوْ لِيَصْمُتْ"} مُتَّفَقٌ عَلَيْهِ 1‏ .‏‏1 ‏- صحيح.‏ رواه البخاري ( 6646 )‏، ومسلم ( 1646 )‏ ( 3 )‏.‏
Translation
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)].