If you have gas, let it out. If you are in the company of others who would be offended by the smell, then excuse yourself from the area and let it rip. Realize that some gas is important for digestion. Food travels through the intestine in segments. Gas between these segments of digesting food helps to propel the food forward.
Gas is thus a natural part of digestion.
However, excessive gas can be diet related, stress related, or associated with constipation. Experiment with your diet to find the least gaseous foods for you. Please realize that if you expel gas in the presence of others, it is not a crime or a sin. We all do it. Just excuse yourself, as you would with a burp.