.gitattributes merge strategy

I tried adding a merge strategy to my .gitattributes file in my repository. But when I connect another branch to this (different) file, it leads to merge-conflict - automatic merge fails.

Here is what I am trying to do.

.gitattributes:

backend/library/project/config.php merge=ours 

Branch:

  • production
  • staging

in production I have config.php'A, and in the configuration stage I have config.php'B.

 > git checkout production > git merge staging > Auto-merging backend/library/project/config.php > CONFLICT (content): Merge conflict in backend/library/project/config.php > Automatic merge failed; fix conflicts and then commit the result. 

I tried adding a line to .git / info / attributes, and also adding quotes to ..merge = "ours".

Does anyone know what I'm doing wrong? (Git version is 1.7.4.4) THX

+6
source share
1 answer

There are two excellent stack overflow answers that solve this problem:

How to tell git to always choose the local version for conflicting merges in a specific file?

and

.gitattributes and individual merge strategy for file

I suggest reading the top answer in the first link. It is long, but very detailed and informative.

+2
source

Source: https://habr.com/ru/post/908353/


All Articles