On Git
网站上有关于 Microsoft Word 版本控制的详细说明.doc
文件与catdoc
.
http://git-scm.com/book/en/Customizing-Git-Git-Attributes http://git-scm.com/book/en/Customizing-Git-Git-Attributes
但是,我意识到这不适用于.docx
文件。看来你需要docx2txt
or unoconv
代替catdoc
(在这里找到 https://stackoverflow.com/questions/15557573/how-to-use-catdoc-to-display-dock-file-encoded-in-utf-8)。我决定去docx2txt
无缘无故,但我被困在安装中docx2txt
进入 Mac OS X。
This https://gist.github.com/nachocab/6429893有点说明了步骤。根据我的理解,你所需要的只是docx2txt.pl
在某个合理的地方。我想/usr/local/bin/
会做。我把它复制到那里。然后,根据指令 https://gist.github.com/nachocab/6429893,我尝试了以下方法:
$ cd /usr/local/bin/
$ echo '#!/bin/bash
docx2txt.pl "$1" -' > docx2txt
当我尝试这个时:
$ docx2txt
I got
Can't read docx file <>!
so, docx2txt
似乎就在路上。
然后我编辑了.gitattributes
在存储库文件夹(ASCII、LF)中添加以下行:
*.docx diff=wordx
然后,我还编辑了存储库中的 .git/config 文件,如下所示:
[diff "wordx"]
binary = true
textconv = docx2txt
因为存储库已经在使用中,所以我没有这样做git init
。我在存储库中编辑了一个 .docx Word 文件,然后输入git diff
在终端中。但结果并不成功。
Binary files a/foo/foo.docx and b/foo/foo.docx differ
有人可以有什么建议吗?