Riyad as-SalihinChapter 17Hadith 1038
Full Sharh — Riyad as-Salihin 1038
وعن أبي موسى رضي الله عنه أن رسول الله صلى الله عليه وسلم قال: "إني والله إن شاء الله لا أحلف على يمين، ثم أرى خيرًا منها إلا كفرت عن يميني، وأتيت الذي هو خير". ((متفق عليه))
English Translation
Abu Musa (May Allah be pleased with him) said:: 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.".
Source
Riyad as-Salihin(رياض الصالحين)
The Book of the Prohibited actions
Hadith Number
1038