This is a very common misconception, but the answer is: No. Gas is a byproduct of the digestive process. The foods that commonly give you gas, such as broccoli, cabbage, beans, etc., do so because their bulk and starch pass into your intestines, and the bacteria in your gut starts to digest them, releasing gas. This gas then collects in your intestines. This mass of food that the bacteria is breaking down does not pass through into your breast milk — it remains with the bacteria in your intestine.
Now, your baby will get gas on his own when his gut bacteria is breaking down the sugars and starches in your breast milk — again, a natural part of the digestive process. Babies can also swallow small amounts of air while they're crying hard or if they're gulping milk a little too quickly.
Sometimes babies have a hard time passing this gas that is trapped in their intestines, which can then be quite uncomfortable for them. Help baby by gently bringing his knees up to his tummy and then down again while he’s lying on his back. This can help some babies move the gas through. Other babies find relief if you gently massage their tummies (olive oil works really well for this) in a clockwise-as-you're-looking-at-them motion.