When meditating, it is best not to judge or feel discouraged if your thoughts come into your focus. Notice them, acknowledge them, and let them pass.
This is also a helpful approach as we go through our day. When a thought that you feel is overly negative or unhelpful or that you don’t want to focus on for whatever reason, comes into your mind don’t try to not think it, just notice it, acknowledge it, and let it pass.
You can be aware of your thinking and acknowledge it without judging yourself. You may want to say to yourself “oh, there’s that thought again”, or just one word to describe the thinking, if you are being judgemental or overly critical, such as just saying to yourself the word “judging”.
If the thought is that you are having cravings for junk food and that you should go and buy some, for example, again, don’t try to fight the thought, just notice and acknowledge it. To acknowledge it you may choose to say the word “cravings” to yourself or keep a post it note near you where you make a tick each time you notice these feelings. And after a few days of noticing and making ticks on the post it note, you will likely see the number of ticks lessening and start to feel better about this aspect of your thoughts.
Noticing the thinking, and acknowledging and naming it, and then letting it pass without judging ourselves or trying to prevent it, is the key to lessening its power over us and its grip on our conscious focus.