Windows 7上的Sourcetree中的Diff Word docx文件

scl*_*e81 6 windows git diff docx atlassian-sourcetree

我一直在尝试在Windows 7上的Sourcetree中使用Word .docx文件的文本差异.我已按照此处的说明使用带有git的Microsoft Word使用Pandoc并可以从命令行使其工作.不幸的是,我无法让这种差异出现在Sourcetree中.为了让它发挥作用,我还需要做些什么吗?

这是我放在项目根目录中的.gitattributes文件:

# Add diff of docx files.
*.docx diff=word
Run Code Online (Sandbox Code Playgroud)

这是我的.git\config文件:

[core]
    repositoryformatversion = 0
    filemode = false
    bare = false
    logallrefupdates = true
    symlinks = false
    ignorecase = true
    hideDotFiles = dotGitOnly
[diff "word"]
  textconv=pandoc --to=markdown
  prompt = false
[alias]
  wdiff = diff --word-diff=color --unified=1
Run Code Online (Sandbox Code Playgroud)

Tog*_*olo 6

我一直在寻找同样的问题.Pandoc似乎与SourceTree不兼容,我想知道一个有效的替代方案.然后我重新评估了几年前使用外部工具xdocdiff解决的WinMerge .步骤:

  • (如果您还没有)在这里下载xdocdiff ,您可以按照建议安装或放入您喜欢的文件夹;
  • 添加的文件夹在Windows PATH变量,如所描述这里(需要重新启动以生效);
  • 通过在命令行窗口中键入命令来验证一切是否正常xdoc2txt,输出将是使用帮助器(如下所示):

    > xdoc2txt
    Usage: xdoc2txt [-s|-e|-j][-c][-f][-r=(0|1|2)] <filename...>
            -s : convert to ShiftJIS(default)
            -e : convert to EUC
            -j : convert to JIS
            -f : output to file
            -c : activate PDF cache
            -p : print property
            -n : ignore permission on PDF;(require cryptlib.dll)
            -r=(0|1|2) : ruby style(0:suppress 1:parentheses 2:aozora bunko
            -o=0 : other option; -o=0:no show PDF page#
            -g=# : PDF gap parameter
            -v : show version number
            -x : output existing cell only(for EXCEL2007)
    
    Run Code Online (Sandbox Code Playgroud)

    只有当这个命令有效时才继续 ;

  • .gitattributes在项目的根目录中添加或编辑文件:

    *.doc diff=xdoc2txt
    *.xls diff=xdoc2txt
    # ...
    # add any other supported extensions you need
    
    Run Code Online (Sandbox Code Playgroud)
  • 编辑.git\config项目根目录中的文件:

    [diff "xdoc2txt"]
      textconv = xdoc2txt
      cachetextconv = true
      binary = true
      prompt = false
    
    Run Code Online (Sandbox Code Playgroud)

这行允许我在SourceTree中看到diff预览.