We all make mistakes. All you can do is apologize and hope the other person will accept your apology.
Have you ever been really mad at someone only to figure out something was going on and suddenly you feel like an awful person? Sorry this is kinda worded funny.
You mean have I ever dived in boots and all and then realised that I was in one in the wrong? Oh, yeah. More than I like to remember. But we learn from the experience and, following Gator Blu's answer, it's a good opportunity to get experience at apologising.