Most definitive way to diagnose hiatal hernia, barium swallow or endoscopy?

Good question. The tests are useful in different ways. A hiatal hernia can diagnosed with either test and very reliably. The egd allows for a biopsy. The UGI allows for an evaluation of the function of the esophagus as well as visualizing actual episodes of reflux.