SUBREDDIT: r/relationships
TITLE: I [M20] cheated on my girlfriend [F19] with my ex [F22]. My girlfriend now knows, how do I win her back?
POST: I [M20] cheated on my girlfriend [F19] with my ex [F22]. My girlfriend and I have been together for about a year. 

I cheated on her this summer. My ex had invited me to spend the weekend with her at her house (we were friends and I wanted to go). I told my girlfriend about it and my girlfriend told me she was uncomfortable with me going and would really prefer if I didn't go. I got really mad at her and we didn't talk for a few days. During those days, I went to my ex's house and I slept with my ex.

I didn't tell my girlfriend because I knew it would hurt her if she knew and I really love my girlfriend. I don't want our relationship to end because I was incredibly stupid one weekend. 

Fast forward to a couple of days ago. One of my friends is talking to my girlfriend. He asks how our relationship is going and she says that it's good. He responds that he's surprised, given what had happened this summer. She, of course, has no idea what he's talking about. And he tells her (not realizing she didn't know) that I had slept with my ex. 

My girlfriend then confronts me, asking me if it's true. I tell her the truth. I tell her everything. She tells me she needs some space and time to think. We haven't spoken since. 

I don't even know what I was thinking. I don't have feelings for my ex, I don't even think my ex is attractive. I love my girlfriend. I can't believe I did this. How do I win her back?
TL;DR: 
I [M20] cheated on my girlfriend [F19] of one year with my ex [F22]. How do I earn her forgiveness and win her back?