Hi there. We went through similar problems with our son, right around 6 weeks while I was breastfeeding. At first I thought it was just reflux, but once he started getting "colicky" (he had previously been very happy) and his poop turned green, I knew something was wrong. Once I told my doctor (who used to specialize in pediatric gastrointenstinal medicine) about his symptoms, she checked him for a milk and soy protein allergy. He also had reflux, which accompanies most babies with the allergy, but that was not what was causing his tummy pain. It's very common in babies actually, but not talked about a lot. If you're breastfeeding and eating any form of dairy or soy (even breads/pasta made with milk or whey or soy) your baby will react if he has it. By the way, oftentimes soy proteins react the same way as milk proteins to babies with the allergy.
It's a very simple test that your doctor can perform. They take a sample of his bowel movement when it's that green color, put it on this special paper, if it turns blue, then yes he has it. And it's very easy to fix once diagnosed :) If you've got questions about this, contact me. I'd be happy to tell you my son's symptoms, etc.
Not sure if this is what your son has, but it may be worth talking to your pediatrician about. Good luck!