Quitting self-harm is the same as quitting any addiction. It's simply figuring out why you do it and finding other things to replace that. For example I used to do it all the time to allow myself to feel something and then I started doing other things for that like cold showers, dunking my head in a bowl of ice water, rubbing ice cubes over my body, exercise, etc. I still slip up from time to time, mostly just when symptoms line up (when impulsivity and self-hatred are severe, especially during mixed states), but I just tell myself "I messed up, I did the best I could, gotta try something else first next time."