.gitattributes merge driver is not used

At first, I know this question How do I tell git to always select my local version for conflicted merges on a specific file? but this post doesn’t help me and I can’t add any comments because of my reputation.

http://git-scm.com/book/en/Customizing-Git-Git-Attributes suggests to set the merge strategy to ours for the path instead of setting a custom merge driver.

  • Move files between Git repos while preserving history
  • Push a file to Heroku that's not in my git repo.
  • How can I convert the output of `git diff --color-words` to HTML?
  • How to work on a feature branch that relies on another unmerged feature branch?
  • Remove commits from master again
  • Git branching: master vs. origin/master vs. remotes/origin/master
  • What is the benefit and differene of adding a custom merge driver return an exit code 0?

    I have a .gitattributes file on my repos top level:

    pom.xml merge=ours
    

    But when I merge two branches with changed pom.xml files the merge can’t be resolved:

    $ git merge origin/master
    Auto-merging pom.xml
    CONFLICT (content): Merge conflict in pom.xml
    Automatic merge failed; fix conflicts and then commit the result.
    

    And I get a standard merge conflict result:

    <pom>
    <<<<<<< HEAD
        <version>0.88-SNAPSHOT</version>
    =======
        <version>0.87.0</version>
    >>>>>>> origin/master
    </pom>
    

    What am I doing wrong?

  • davibennun laravel track push notification
  • Better to use Tag or Branch?
  • Git push is not 'pushing' a new branch
  • Revert a single change in a file in Git
  • git refuses password, only when logged in as root
  • Git Annex with GitHub?
  • One Solution collect form web for “.gitattributes merge driver is not used”

    You can declare a merge driver, but that means you have to define it on the git config, as in “.gitattributes & individual merge strategy for a file”:

    [merge "ours"]
        name = "Keep ours merge"
        driver = true
    

    That allows for a merge strategy for a file, or set of files, as opposed to the -s option for git merge strategies, which doesn’t require you to define a driver, but which would resolve the conflict for all files (not just for pom.xml)

    git merge -s ours
    
    Git Baby is a git and github fan, let's start git clone.