Gas pain?!?

Amanda • 22. Married 💍. 3 year old son. Due with baby #2 July 5th 2016.
I woke up in the middle of the night and my upper area of my stomach near my ribs was hurting really bad. I went to the bathroom and had some gas and went poop. The pain came back on and off. It was weird and hurt really bad. I'm fine now but it made me very worried. There was no blood. Has anyone else experienced this? I'm 11 weeks & 2 days.