I do not know if it happens to you but it does happen to me: I get angry at something only to find out later that I had no reason whatsoever to get angry.
It can be more than embarrassing. People get angry back at you. You might lose friends, spouses, or the love of your children just because you repetitively were angry for something that you had no reason to get angry at. They shun you because your anger is unpredictable and misdirected.
How does it happen?
Why does it happen?
My insight is that an event triggers our anger because we assume a certain motivation drove that event. And that motivation was erroneous.
A child does not do something you have asked him to do.
Before finding out what happened you assume the kid is showing lack of discipline, is not accepting your authority, and you get angry.
Later you find out that your assumption was wrong. He got diverted to do something else that someone else asked him to do and he could not do what you wanted him to do.
Where did those assumptions come from?
From the past.
In the past, you had some experiences that apparently repeated themselves more than once until they became your ready-made explanation to certain behavior. When confronted with a similar situation, you assume the same reasoning happened again. You have a ready-made answer to the question of why it happened. There is NO need to think. NO need to investigate. You believe you know why it happened.
In your past, let us say, while growing up your brother or sister repetitively refused to cooperate with you and put you down. This pattern got fused into your consciousness and now you have a ready-made explanation to situations that subconsciously remind you of the same pattern.
So you ASSUME, without even being conscious of it, that your kid also refuses to cooperate. And all your stored anger against your brother is now unloaded with anger at your child.
This pattern is one of looking at the present through the prism of the past.
What to do?
I read somewhere some beautiful advice one had given: be curious before judging.
To be curious means to me to ask questions before deciding. Accumulating information and processing it before judging. In other words, stop assuming anything.
Treat each experience like it is happening to you for the first time. And come to think of it, it is for the first time. No two experiences are ever identical. There is change that happened since the last similar experience. This change is called life.
Be like a growing child. Be curious. Be willing to learn. To experience, and learn from experience.
Or be like a dog. Each time your pet meets you when you come home it treats you like you have come for the first time. It does not show anger for whatever you did to it before.
Ask questions more and use less exclamation marks.