Version control Word .docx files with docx2txt with Git on Mac OS X

后端 未结 1 802
[愿得一人]
[愿得一人] 2021-02-03 16:14

On Git web site there is a detailed instruction for version controling Microsoft Word .doc files with catdoc.

http://git-scm.com/b

相关标签:
1条回答
  • 2021-02-03 16:31

    Thanks to klang, I made it. Now I can diff .docx files in Terminal.app in Mac OS X (10.9). But this one doesn't seamlessly work with SourceTree GUI. Below is basically the same as klang's but with minor corrections.

    Download and install the docx2txt converter from http://docx2txt.sourceforge.net/

    wget -O doc2txt.tar.gz http://docx2txt.cvs.sourceforge.net/viewvc/docx2txt/?view=tar
    tar zxf doc2txt.tar.gz
    cd docx2txt/docx2txt/
    sudo make
    

    Then make a small wrapper script to make docx2txt output to STDOUT

    echo '#!/bin/bash
    docx2txt.pl "$1" -' > /usr/local/bin/docx2txt
    chmod +x /usr/local/bin/docx2txt
    

    Git attributes for (Word) .docx diffing in your repository

    echo "*.docx diff=wordx" >> .gitattributes
    git config diff.wordx.textconv docx2txt
    

    Use .git/info/attributes if the setting should not be committed with the project.

    Git attributes for (Word) .doc diffing

    echo "*.doc diff=word" >> .gitattributes
    git config diff.word.textconv strings
    
    0 讨论(0)
提交回复
热议问题