It's largely like quitting smoking or something - you have to combine will-power and the physical part of the habit. First, I thought of why I wanted to quit. I'm around small kids, and I would hate to worry about them potentially seeing it and saying, what happened? It makes it clearer that I'm not healthy - I don't have sex until I've healed. Plus there's the possibility of being sent away if I'm caught at it again.
That's my motivation.
I've heard a lot of ways to stop. Some people hold ice cubes in their hands when they feel like cutting; some people snap themselves with a rubber band. I've also heard of using a red marker so you see the red and don't hurt yourself. You have to realize that there is a deeper reason for what you're doing and si doesn't solve anything, as much relief as you may feel.
You may find other stuff on the cutting and self-injury forum on this site. Just be careful not to trigger.
We're all mad here.