A similar tradition has been transmitted by 'Abd al-Rahman b. Samurah through a different chain if narrators. This version has: "Make atonement for your oath and then do the thing that is better."
Abu Dawud said: The version of this tradition transmitted by Abu Musa al-Ash'ari, 'Adi b. Hatim and Abu Hurairah are variant. Some of them indicate breaking the oath before making atonement, and other making atonement before breaking the oath.
Narrated Abu Burdah:
On the authority of his father that the Prophet (ﷺ) said: I swear by Allah that if Allah wills I shall swear on an oath and then consider something else to be better than it without making atonement…
Narrated 'Abd al-Rahman b. Samurah:
The Prophet (ﷺ) said to me: 'Abd al-Rahman b. Samurah, when you swear an oath and consider something else to be better than it, do the thing that is beter and make atonement for your…