Performing configuration management

Hi there,
I have a question about structuring my project(s).
I’m planning on using gitlab to manage and track configuration files of network devices.

The Problem is That I have 2 different environments in which those configs will be deployed. Each environment does require some special configuration, though about 90% is the same for both.

Is there a way to have e.g. one main-branch for both environments and perform merges to separate branches (env1, env2) without losing or overriding those parts that differ?

Best regards,