The Messenger of Allah ﷺ said: An oath or a vow about something over which a human being has no control, and to disobey Allah, and to break ties of relationship is not binding. If anyone takes an oath and then considers something else better than it, he should give it up, and do what is better, for leaving it is its atonement. Abu Dawud said: All sound traditions from the Prophet ﷺ say: "He should make atonement for his oath," except those versions which are not reliable. Abu Dawud said: I said to Ahmad: Yahya b. Sa'id (al-Qattan) has transmitted this tradition from Yahya b. 'Ubaid Allah. He (Ahmad b. Hanbal) said: But he gave it up after that, and he was competent for doing it. Ahmad said: His (Yahya b. 'Ubaid Allah's) tradition are munkar (rejected) and his father is not known. (Using translation from Abū Dāʾūd 3274)
قَالَ رَسُولُ اللهِ ﷺ لَا نَذْرَ وَلَا يَمِينَ فِيمَا لَا يَمْلِكُ ابْنُ آدَمَ وَلَا فِي مَعْصِيَةِ اللهِ وَلَا فِي قَطِيعَةِ رَحِمِهِ وَمَنْ حَلَفَ عَلَى يَمِينٍ فَرَأَى غَيْرَهَا خَيْرًا مِنْهَا فَلْيَدَعْهَا وَلْيَأْتِ الَّذِي هُوَ خَيْرٌ فَإِنَّ تَرْكَهَا كَفَّارَتُهَا وَرُوِي ذَلِكَ مِنْ وَجْهٍ آخَرَ أَضْعَفَ مِنْ هَذَا