Setting a "git config" option at the GitLab server

This [1] stackoverflow answer explains the full detail of what I am attempting, but the piece I am missing is being able to do the equivalent of this command in gitlab:

git config --global merge.ours.driver true

Is there a way I can do this ?




I had read your topic but didn’t know the answer. Luckily a similar question on merge strategies was asked today moving the knowledge along: How to ignore .gitlab-ci.yml file when merging the branches

TL;DR - the setting needs to done on the GitLab server itself, which is discussed in this feature request. I don’t know whether the mentioned workarounds really work. Maybe @Linds or @gitlab-greg can chime in here :slight_smile:



Hi Michael,

Thank you for your response :slight_smile:

I am not sure the workarounds are usable in my case, but I’ll look in to them in more detail.

It’s good to know there’s a feature request that would solve this.


1 Like

Good question and great answer @dnsmichi.

I think a combination of Permissions, and Protected branches may help to protect your code from unwanted changes while still granting “force push” capability to certain members. For resolving merge conflicts with a “Use ours” policy, I believe similar results can be achieved using the web IDE’s Resolve conflicts: interactive mode, but this would require a manual review step to resolve each merge conflict.

For a long term solution, I think the feature request that @dnsmichi linked is the best path forward:

I encourage you to contribute to the conversation in the issue comments. We use issues to prioritize work and evaluate demand for new feature requests, and your feedback is valuable.


Hi Greg,

Thanks for the comment and recommendations. We have implemented permissions and protected branches which greatly reduces the possibility of merging files that we don’t want merged.

A manual step to resolve the conflict always has possibility to go wrong (to err is human!), and it seems a automated solution is close to achievable. Hopefully the feature request will make it on to your roadmap soon!