The Prohibition of swearing to abandon a Good Deed
Allah commands,
وَلَا تَجْعَلُواْ اللّهَ عُرْضَةً لاِّاَيْمَانِكُمْ أَن تَبَرُّواْ وَتَتَّقُواْ وَتُصْلِحُواْ بَيْنَ النَّاسِ وَاللّهُ سَمِيعٌ عَلِيمٌ
And make not Allah's (Name) an excuse in your oaths against doing good and acting piously, and making peace among mankind. And Allah is All-Hearer, All-Knower (i.e., do not swear much and if you have sworn against doing something good then give an expiation for the oath and do good).
Allah commands, `You should not implement your vows in Allah's Name to refrain from pious acts and severing the relations with the relatives, if you swear to abandon such causes.'
Allah said in another Ayah;
وَلَا يَأْتَلِ أُوْلُواْ الْفَضْلِ مِنكُمْ وَالسَّعَةِ أَن يُوْتُواْ أُوْلِى الْقُرْبَى وَالْمَسَـكِينَ وَالْمُهَـجِرِينَ فِى سَبِيلِ اللَّهِ وَلْيَعْفُواْ وَلْيَصْفَحُواْ أَلَا تُحِبُّونَ أَن يَغْفِرَ اللَّهُ لَكُمْ
(And let not those among you who are blessed with graces and wealth swear not to give (any sort of help) to their kinsmen, Al-Masakin (the poor), and those who left their homes for Allah's cause. Let them pardon and forgive. Do you not love that Allah should forgive you! (24;22)
Continuity in a sinful vow is more sinful than breaking it by expiation.
Allah's Messenger said;
وَاللهِ لَااَنْ يَلَجَّ أَحَدُكُمْ بِيَمِينِهِ فِي أَهْلِهِ اثَمُ لَهُ عِنْد اللهِ مِنْ أَنْ يُعْطِيَ كَفَّارَتَهُ الَّتِي افْتَرَضَ اللهُ عَلَيْه
By Allah! It is more sinful to Allah that one of you implements his vow regarding (severing the relations with) his relatives than (breaking his promise and) paying the Kaffarah that Allah has required in such cases.
This is how Muslim reported this Hadith and also Imam Ahmad.
Ali bin Abu Talhah reported that Ibn Abbas said that what Allah said;
وَلَا تَجْعَلُواْ اللّهَ عُرْضَةً لاِّاَيْمَانِكُمْ
(And make not Allah's (Name) an excuse in your oaths) means,
"Do not vow to refrain from doing good works. (If you make such vow then) break it, pay the Kaffarah and do the good work."
This was also said by Masruq, Ash-Sha`bi, Ibrahim An-Nakhai, Mujahid, Tawus, Sa`id bin Jubayr, Ata, Ikrimah, Makhul, Az-Zuhri, Al-Hasan, Qatadah, Muqatil bin Hayyan, Ar-Rabi bin Anas, Ad-Dahhak, Ata Al-Khurasani and As-Suddi.
Supporting this view, which is the majority view, is what is reported in the Two Sahihs that Abu Musa Al-Ashari narrated that Allah's Messenger said;
إِنِّي وَاللهِ إِنْ شَاءَ اللهُ لَا أَحْلِفُ عَلى يَمِينٍ فَأَرَى غَيْرَهَا خَيْرًا مِنْهَا إِلاَّ أَتَيْتُ الَّذِي هُوَ خَيْرٌ وَتَحَلَّلْتُهَا
By Allah! Allah willing, I will not vow to do a thing and then see a better act, but I would do what is better and break my vow.
Muslim reported that Abu Hurayrah said that Allah's Messenger said;
مَنْ حَلَفَ عَلى يَمِينٍ فَرَأَى غَيْرَهَا خَيْرًا مِنْهَا فَلْيُكَفِّرْ عَنْ يَمِينِهِ وَلْيَفْعَلِ الَّذِي هُوَ خَيْر
Whoever makes a vow and then finds what is better than his vow (should break his vow) pay the Kaffarah and perform the better deed.