If you grab a bowl of muddy water and then pour in a clear stream of fresh water, you'll notice that the fresh water gradually clears the entire bowl until the mud is no longer noticeable.
Imagine the bowl as your mind, the muddy water representing negative thoughts, and the clear water symbolizing positive ones. Pour in the kind of thoughts you desire, and in this way, you can clear away the muddiness that has plagued you for so long.
According to the Yogi teachings, a positive thought always tends to neutralize and transform a negative one. In other words, by using your willpower and staying committed, you can change the thoughts in your mind. Including the ones you've inherited, and become a different person in terms of your personality and behavior.
So how can you rid yourself of negative emotions? By thinking about things that evoke positive emotions.
And how do you focus on things that generate positive emotions?

