Caution: Translations of Quran and Ḥadīth may lead to possible misapplications and misinterpretations. This site is intended for students of sacred knowledge that are proficient in comprehending classical Arabic and have a strong foundation in Islamic sciences. Also note that religious injunctions rely on several aspects beyond what one may glean through reading individual aḥādīth.
quran:27:11

Otherwise, he who wrongs, then substitutes good after evil - indeed, I am Forgiving and Merciful.  

except him who has wronged, his soul, but then changed ˹his wrong˺ for good — he ˹then˺ performs ˹good deeds˺ — after ˹having done˺ evil, in other words, ˹he has˺ repented, then truly I am Forgiving, Merciful, I will accept his repentance and forgive him.
القرآن:٢٧:١١

إِلَّا مَنْ ظَلَمَ ثُمَّ بَدَّلَ حُسْنًا بَعْدَ سُوءٍ فَإِنِّي غَفُورٌ رَحِيمٌ  

{إلا} لكن {من ظلم} نفسه {ثم بدَّل حُسناً} أتاه {بعد سوءٍ} أي تاب {فإني غفور رحيم} أقبل التوبة وأغفر له.