Make sure it never happens again? this is impossible, people will hurt each other, we must accept it and be nice when we can.
You need to figure out what you did wrong, sincerely apologize for it, and learn how to change it.
Yes I did. The hardest thing to do was to stop blaming and accept the truth that my immaturity was damaging and unacceptable :( Then I worked on myself to grow my personality so that I was a person that wouldn't hurt others. I also had to take a lot of well-deserved anger until reconciliation could occur.