Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

.gitattributes merge strategy [duplicate]

Tags:

git

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

like image 490
thesonix Avatar asked Feb 13 '12 17:02

thesonix


1 Answers

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.

like image 149
ulmangt Avatar answered Sep 20 '22 16:09

ulmangt