3

Whereas it is not so difficult, to get docx files diffed through

git diff xxx.docx

i did not find a way to do so using git difftool which would be quite convenient. To recall configuration for diff:

  • in gitattributes place a line *.docx diff=word, where word is just a placeholder
  • in gitconfig place
[diff "word"]
  textconv = astextplain

Here, asplaintext is some converter converting .docx into plain text.

If i call git difftool xxx.docx these tools seem not to be applied. I would expect that the difftool is invoked with output of asplaintext, but it is not.

Am I too stupid to find a way, or is this just a gap in git?? That feature would be very nice because i use gitahead which invokes, as many other gui backends git difftool.

Reissner
  • 31
  • 2
  • 1
    `.docx` files are zip files, binaries, you can't compare them as text and get any meaningful data. – Blindy Jun 02 '20 at 14:45
  • 1
    You could try: https://github.com/vigente/gerardus/wiki/Integrate-git-diffs-with-word-docx-files – Philippe Jun 02 '20 at 15:47
  • What @Philippe said! I use that too. pandoc is required, for me it just happens that I already used pandoc to begin with. To sum up what you are going do: add a new diff command that converts docx to markdown, tell repo to use new diff for docx-files. You might want to tweet the pandoc command a bit and add the command parameter 'preserve line' or something like that. Works like a charm – TheDudeWithHat Jun 02 '20 at 17:16
  • 1
    @blindy, i know. But still there are ways to do so if filtering those files accordingly. See the git manual. – Reissner Jun 02 '20 at 19:46

0 Answers0