1

I want to ignore my project version file from auto-merge in Bitbucket Server as this file is always going to be different for different branches. For this, I have created a merge driver similar to the below in repository's .gitconfig

[merge "ours"]    
    driver = true

I have added .gitattribute file at the root of the repository with the below content (to ignore this file for the merge):

version.txt merge=ours

However, Bitbucket Server, doesn't seem to use the .gitconfig settings in my repo and it always conflicts on this file. How can I configure bitbucket server to read and apply the my settings in .gitconfig?

thoudam
  • 11
  • 1

2 Answers2

1

I had the same problem recently and the only workaround that Atlassian currently suggest is the following:

  • Login to your Bitbucket server via terminal.
  • Execute git config --global merge.ours.driver true

This will activate your custom merge strategy and the next time you create a pull request that has a conflict on the version.txt file, it will be automatically resolved, by applying the "ours" (destination branch) state.

Konstantin Yovkov
  • 59,030
  • 8
  • 92
  • 140
0

I think you should refactor your build completely. Why aren't you just versioning your master branch. Are your sub branches really versioned? You could create a git hook for tagging branches where you simple write a bash command writing the version to your version.txt file

code1x1.de
  • 194
  • 13