Oil pipeline construction and operation in mountainous areas have increased in southwestern China, with oil consumption increasing. Such liquid pipelines laid in mountainous areas continuously undulate along the terrain, resulting in many large elevation difference pipe segments. Serious gas block problems often occur during the commissioning process of these pipelines due to the gas/air accumulation at the high point of the pipe, which causes pipeline overpressure and vibration, and even safety accidents such as bursting pipes. To solve this problem, the gas–liquid replacement model and its numerical solution are established with consideration of the initial gas accumulation formation and the gas segment compression processes in a U-shaped pipe during the initial start-up operation. Additionally, considering the interactions of the gas-phase transfer in the continuous U-shaped pipe, and the influence of the length, inclination angle, and backpressure on the air vent process, the gas migration model for a continuous U-shaped pipe is established to predict the gas movement process. Finally, the field oil pipe production data were applied to verify the model. The results demonstrate that the maximum deviation between the calculated pressure during the start-up process and real data is 0.3 MPa, and the critical point of crushing the gas in the pipe section is about 0.2 Mpa. Additionally, the results show that the mass transfer of the gas section in the multi-pipe hydraulic air vent process causes the gas accumulation section to increase in downstream of the pipe. This study’s achievements can provide theoretical guidance and technical support for the safe and stable operation of continuous undulating liquid pipelines with large drops.