You need to come to a full understanding of why you had the earlier behavior that you’re now trying to change. Then you need to defeat your earlier behavior in detail.
Normally when armies clash, it lasts long enough to rout one side. Basically they just turn tail and run. This satisfies your short-term goals, but leaves your enemy alive to fight another day. Destroy their entire army, however, and they can’t.
In order to apply this to behavior change, you need to see the behavior you’re trying to change as a collection of smaller things, each of which can be attacked and eliminated.
For example, if you’re trying to eat better, you can make a catalog of all the different ways you eat, and make sure you have better options for each of those scenarios. Then it becomes a matter of tactics and discipline rather than strategy.