Riyad as-Salihin #1717 · The Book of the Prohibited actions

Riyad as-SalihinAbu Musa al-Ashari
Riyad as-Salihin · Book 18 · The Book of the Prohibited actions
Riyad as-Salihin · كتاب 18 · كتاب الأمور المنهي عنها
The Messenger of Allah (صلى الله عليه وسلم) said, "Verily, I swear by Allah, if Allah wills, I shall not swear to do something but that if I consider something else to be better than it, then I shall make expiation for my oath and adopt the thing that is better." [Al-Bukhari and Muslim] .
وعن أبي موسى رضي الله عنه أن رسول الله صلى الله عليه وسلم قال:
"إني والله إن شاء الله لا أحلف على يمين، ثم أرى خيرًا منها إلا كفرت عن يميني، وأتيت الذي هو خير" . ((متفق عليه))
Reference : Riyad as-Salihin 1717In-book reference : Book 18, Hadith 207