If the put-it-off-until-it-goes-away approach doesn't work for you, you could always try the indulge-it..just-a-little approach. So if I feel like scoffing a whole 250g block of crappy chocolate, I could instead buy a 60g block of Maya Gold and endeavour to eat just half of it, enjoying it slowly without feeling guilty and feeling warm and fuzzy because it's organic and fair trade. Also trying to consider what I might really need to eat. Because sometimes I will binge on the usual suspects just out of sheer habit, and we all know that no amount of chocolate will actually fix a craving for pineapple
There are a few theories that cravings can indicate dietary deficiencies, so it might be worthwhile to check that out and if necessary seek advice on whether supplements might be appropriate.