Tango and Jazz both had really bad gas when I rescued them. But they were also on the crappiest food imaginable! Jazz was being fed this no-name generic crap from the grocery store, and Tango ate table scraps and low quality cat food.
Part of dealing with their ill-health was to switch them over to a superior dog food~I chose Evo Innova. Once their health started to improve with lots of Vet care and excellent food and uber care and attention from me, their gas and digestive issues faded away. Their poops are firm and virtually odorless, and there's very little of it because their bodies are utilizing almost all of what they eat. It's just pure nutrition and no crap or fillers. Plus their gas issues disappeared completely. I can't even remember the last time I smelled or heard a toot from them!