The ego’s goal is to make you identify with it, whatever form it takes. Your task is to bring space between you and the ego. How? Recognize that the upcoming thought / emotion is not you, but it’s inside you (I’m not sad, but i have sadness in me).
How do you know that it’s inside you and not you? It’s simple: Just as the dreamer don’t know that he’s dreaming as long as he won’t step over the level of the dream, you don’t know either that you identify with thoughts or emotions as long as you won’t step over them. As soon as you recognize them as they are there, you’re immediately got the chance too choose and you just stepped over their levels. If the thoughts or emotions were you, then you won’t ever be able to recognize them (you can’t surpass yourself).
The separation you from the ego makes the egoic thoughts and emotions start losing energy, because it’s necessary for their survival to make you identify with them. They can’t survive the light of your consciousness.
The last step is to accept the thoughts and emotions in you. Don’t make a problem out of them, let them be. They don’t rule you any more.