There are so many different temptations out there for everyone, whether it be food cravings, impulses to buy things, desire to quit something, or any other material item or idea that you really wish you could get/do. But most of the time, it's not the best option in the long run to give into those temptations.
There is no way to stop having temptations all together, but there are actions and mindsets that one can take to decrease the chance of giving into a temptation.
A really good way to control your impulses is to think of the long run. If it's a food craving that is unhealthy, think of how much you will have regret eaten that food, and how guilty and bad you would feel knowing that you couldn't control yourself. If it was an object you wanted to buy, think of other ways you can use the money instead.
Another great way to prevent giving into impulses is to have a good support system. Whether it be a trivial small habit that you're trying to shake or a big change that you're trying to make in your life, it is so important to have people there that support you and what you are going through. Maybe find some friends that are also trying to get rid the habit of giving into temptations: support and look out for each other.
Despite all this talk of not giving into temptation; it is okay sometimes to give yourself a break, and have fun, as long as it is in moderation and controlled.