HEALTH WARNING. If you have never experienced symptoms like this before and you're over 25-30 OR if you have had these symptoms for a while, but they're getting worse, go to your GP and talk it through.
Otherwise, there are two parts to this - reflux, and acid. Reflux is the experience of nasty tasting liquid flooding up your oesophagus into your mouth. The acid is what gives it the painful, burning sensation (there is a caveat to this to which I will return). Reflux is more likely to occur in those who are overweight, have anatomical problems at the lower end of the oesophagus and who eat particular foods. The first two are difficult to modify...
Fatty foods are particularly likely to provoke reflux (hence pork pies), partly because they're digested slowly and linger longer in the stomach (there are other reasons too). Some find caffeine provocative and several other foods are suggested as difficult, including alcohol. You are less likely to get reflux if you avoid a heavy meal before caving (ie eat 3-4 hours beforehand) or if you confine yourself to small volume, low fat (high calorie) snacks. These should minimise your likelihood of experiencing reflux but won't guarantee you won't get it.
Without the acid, reflux merely gives an unpleasant sensation and taste - also bad breath - (second hand, partly digested food is rarely desirable). To control the acid component there are two options.
(1) Drugs like omeprazole and pantoprazole can be bought over the counter and will give you 10-14 hours of acid suppression (so relatively painless reflux). Esomeprazole probably gives you a couple of hours more. What they do is stop your stomach producing acid when it has been stimulated by eating. Therefore, you need to take them an hour before food or several hours after eating. This may make scheduling complex...
(2) Acid neutralising drugs, which vary from simple antacids to more complex drugs like Gaviscon (cheaper generic versions are available). you can buy this in glass bottles (convenient for a quick glut after a hard night in the pub, but impractical underground) or in chewable tablet form - much more sensible.
Recommendation: (1) Review your pre-caving meal (2) Consider taking omeprazole (or similar) before a trip or, dependent on the length of the trip, during it. Remember, it will take 30 minutes for the tablet to work and you shouldn't eat a big meal for at least 30 minutes after taking the pills. (3) Take some form of antacid with you for emergency relief. The cheap and cheerful ones work briefly, the more expensive ones should give you a longer period of relief (Gaviscon is very expensive and Boots will sell you a similar thing much more cheaply).
Finally, if none of this works, seeks gastroenterological advice. There are surgical options that are pretty effective but should be a late, if not last resort.
The caveat I mentioned earlier is that if you successfully block acid production from the stomach, you can get bile refluxing from the small intestine, through the stomach to the oesophagus. this is alkaline (so still irritating) and tastes equally disgusting. I don't have a simple solution to suggest for this...