Forums

Articles
Create
cancel
Showing results for 
Search instead for 
Did you mean: 

Custom merge strategies for specific folders via .gitattributes

Semenov Evgeniy April 28, 2018

Hello!

We're using Bitbucket Server v5.8.0 and trying to achieve some special workflow: for our `/dist` directory with compiled files (needed in git repo for some reason) we want the conflicts never to occur. Means that any conflict within `dist` directory should be resolved with (for example) `ours` strategy in all the PRs.

So far we've done:

  • added `.gitattributes` file to all of the branches with content `dist/ merge=ours` (tried `dist/**/* merge=ours` too)
    bb-surv-2.png
  • executed `git config --global merge.ours.driver true` on a developer's machine and on Bitbucket Server machine under BB service user both

– and so far this works on local machine when merging a branch to master, but doesn't seem to work in Bitbucket Server during the PR merge checks

bb-surv-1.png

 

Please help us fight these conflicts :)

Thanks!

Regards,
Evgeniy

1 answer

0 votes
Baskar Annamalai
Atlassian Team
Atlassian Team members are employees working across the company in a wide variety of roles.
May 29, 2018

Hi Evgeniy,

 

Can I know if you've attempted to resolve the conflict as suggested in https://confluence.atlassian.com/bitbucket/resolve-merge-conflicts-704414003.html

 

Regards,

Aaron Hooper
I'm New Here
I'm New Here
Those new to the Atlassian Community have posted less than three times. Give them a warm welcome!
June 29, 2018

I believe you have misunderstood the question. Using a customer merge driver, what they accomplished by running `git config --global merge.ours.driver true ` and adding to the gitattributes file, should allow the merge conflict to resolve itself by allowing using the "ours" version automatically. The question is why is Bitbucket ignoring the .gitconfig settings during pull requests?

Semenov Evgeniy June 29, 2018

Exactly!

hesam al
I'm New Here
I'm New Here
Those new to the Atlassian Community have posted less than three times. Give them a warm welcome!
May 15, 2019

Any update on this issue ? 

I want to be able to by pass pull request conflict ( GUI ) if the merge strategy is set to ours on the specific file. Thanks.

Boris Klug
I'm New Here
I'm New Here
Those new to the Atlassian Community have posted less than three times. Give them a warm welcome!
August 20, 2019

We have the same problem. We want to use a custom merge driver to easily merge Maven poms with different version numbers using the fantastic pomutils (see (*1)).

And it works - but Bitbucket claims in the pull request that there is a conflict. Than, when you look at the diff, there is no differences because of the merge driver.

Please Atlassian - fix this!

 

(*1) https://github.com/cecom/pomutils

Suggest an answer

Log in or Sign up to answer
TAGS
AUG Leaders

Atlassian Community Events