The Yoga Sutras refer to negative thoughts (Vitarka) and how to get rid of them. The solution is to think of something positive. This is pratipaksha bhavana and is so much easier said than done.
How many times during the day does someone (usually a close friend or family member) say something and suddenly your gut tightens? Maybe you respond verbally, maybe you keep your thoughts to yourself, but the cortisol in your body is already released and cortisol is the chemical that stresses your body. My cardiologist once told me that it takes 4-6 hours for the cortisol to be reabsorbed into your system. When cortisol rushes into your system, your blood pressure rises. You become distracted. Whatever you were doing before is forgotten.
This is a natural response, but for me I’ve found that the key to practicing pratipaksha bhavana is to catch myself, to be aware of what is happening, and either remove myself physically from the situation or stop to take a deep breath. Depending on the circumstances, maybe it takes five or ten breaths. Sometimes I take a walk in nature or look up into the sky and watch the clouds float by. The point is to be aware of these circumstances as quickly as possible and come back to peace.