Not beating oneself up

So, it seems common, after we notice that we have the thought that we ‘know’ is not helpful, which then creates a certain feeling, which may generate another thought that leads to some kind of ‘buffering’—like having a drink we had decided not to have, or eating a piece of chocolate, or just needing to check on something, or just having to make that phone call—to beat ourselves up. This came up on the buffering call today, and how we need to be kind and loving to ourselves. Besides to just stop beating ourselves up, what are kind and loving thoughts to replace beating up thoughts? How can we catch on to the fact that we are beating ourselves up?