title: Where's the 3-way Git merge driver for .PO (gettext) files?
body: <p>I already have following</p>
  
  <pre><code>[attr]POFILE merge=merge-po-files
  
  locale/*.po POFILE
  </code></pre>
  
  <p>in the <code>.gitattributes</code> and I'd like to get merging of branches to work correctly when the same localization file (e.g. <code>locale/en.po</code>) has been modified in paraller branches. I'm currently using following merge driver:</p>
  
  <pre><code>#!/bin/bash
  # git merge driver for .PO files (gettext localizations)
  # Install:
  # git config merge.merge-po-files.driver "./bin/merge-po-files %A %O %B"
  
  LOCAL="${1}._LOCAL_"
  BASE="${2}._BASE_"
  REMOTE="${3}._REMOTE_"
  
  # rename to bit more meaningful filenames to get better conflict results
  cp "${1}" "$LOCAL"
  cp "${2}" "$BASE"
  cp "${3}" "$REMOTE"
  
  # merge files and overwrite local file with the result
  msgcat "$LOCAL" "$BASE" "$REMOTE" -o "${1}" || exit 1
  
  # cleanup
  rm -f "$LOCAL" "$BASE" "$REMOTE"
  
  # check if merge has conflicts
  fgrep -q '#-#-#-#-#' "${1}" &amp;&amp; exit 1
  
  # if we get here, merge is successful
  exit 0
  </code></pre>
  
  <p>However, the <code>msgcat</code> is too dumb and <strong>this is not a true three way merge</strong>.
  For example, if I have</p>
  
  <ol>
  <li><p>BASE version</p>
  
  <pre><code>msgid "foo"
  msgstr "foo"
  </code></pre></li>
  <li><p>LOCAL version</p>
  
  <pre><code>msgid "foo"
  msgstr "bar"
  </code></pre></li>
  <li><p>REMOTE version</p>
  
  <pre><code>msgid "foo"
  msgstr "foo"
  </code></pre></li>
  </ol>
  
  <p>I'll end up with a conflict.
  However, <strong>a true three way merge driver would output correct merge</strong>:</p>
  
  <pre><code>msgid "foo"
  msgstr "bar"
  </code></pre>
  
  <p>Note that I cannot simply add <code>--use-first</code> to <code>msgcat</code> because the REMOTE could contain the updated translation. In addition, if BASE, LOCAL and REMOTE are all unique, I still want a conflict, because that would really be a conflict.</p>
  
  <p><strong>What do I need to change to make this work?</strong> Bonus points for less insane conflict marker than '#-#-#-#-#', if possible.</p>