The Messenger of Allah ﷺ said, "Whoever swears an oath that involves cutting ties of kinship or doing something improper, the right course is not to carry it through."
حدثنا علي بن محمد حدثنا عبد الله بن نمير عن حارثة بن أبي الرجال عن عمرة
قال رسول الله ﷺ من حلف في قطيعة رحم أو فيما لا يصلح فبره أن لا يتم على ذلك
No references are available.
Sourcing, its chain is daif. Tabarani narrated it in Awsat (5/485, no. 4818) from the hadith of Haritha, through the same route, and see no. 56 regarding its defect. Tahawi narrated it in Mushkil (12/287) with a hasan chain from Ibn Abbas, who attributed it to the Prophet, saying, "Whoever swears an oath to cut off a relationship or to commit a sin, and then breaks it, that is an expiation for him."