13

I tried to add a merge strategy to my .gitattributes file in my repository. But when I merge another branch with that (different) file it results in a merge-conflict - auto merge failed.

Here's what I try to do.

.gitattributes:

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

Branches:

  • production
  • staging

in production I have config.php'A and in staging 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 the line to .git/info/attributes as well as adding quotes to ..merge="ours".

Has anybody an idea what I am doing wrong? (Git-version is 1.7.4.4) thx

0

1 Answer 1

4

There are two excellent Stack Overflow responses which address this problem:

How do I tell git to always select my local version for conflicted merges on a specific file?

and

.gitattributes & individual merge strategy for a file

I'd suggest reading through the top answer in the first link. It's long, but very detailed and informative.

Sign up to request clarification or add additional context in comments.

1 Comment

Instead of linking to SO questions, please flag the question as a duplicate.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.