See? That's great that you don't want to be that kind of person and I know it's difficult to stop. There are a multitude of ways to try and monitor your own behavior but it'll have to be little by little to make lasting progress.
Start with apologizing to her when you do something that makes you feel bad. Spend less time alone with her and help use others to keep you in line. Tell her that you've just been going through some rough patches and you know that you've been harsh to her and you're working on it. Keeping an open dialogue is extremely important and often the best policy.
These things take time. Gently work on it and you'll get better