Well it's the same as starting an exercise or workout routine. The only sure way to do it is to make a rule for yourself that you will not do something you like until you have either A, worked out, or B, not broken your diet that day, etc.
Of course that won't work if you will cheat and do whatever it is (watch TV, surf the web, or whatever it is) anyway. If you have zero self control then you will not be successful with any new habit you try to start.
I think the best way to do it is just to be very conscious of it and try not to distract yourself from reaching your goals.