Track Microsoft Word doc changes in Git using pandoc (!!)

Great tip for using Git to track Microsoft word documents:

http://blog.martinfenner.org/2014/08/25/using-microsoft-word-with-git/

TLDR: convert Word docs to markdown via pandoc and track changes there

# .gitattributes file in root folder of your git project
*.docx diff=pandoc
# .gitconfig file in your home folder
[diff "pandoc"]
  textconv=pandoc --to=markdown
  prompt = false
[alias]
  wdiff = diff --word-diff=color --unified=1

You can then use git wdiff important_file.docx to see the changes (with deletions in red and insertions in green), or git log -p --word-diff=color important_file.docx to see all changes over time.

Leave a Reply

Your email address will not be published. Required fields are marked *