git 默认只会git diff 文本文件,不能对doc、docx 文件格式进行diff,所以需要用到特殊的工具将doc、docx格式的word文件转换为文本格式。 这儿用到的工具是pandoc

一 安装 pandoc

pandoc下载地址 , 直接下载安装就可以了。

二 需要更改 git软件的安装地址 中 .../Gig/etc/gitconfig , 修改gitconfig文件

// 在后面新增以下内容
[diff "pandoc"]
  textconv=pandoc --to=markdown
  prompt = false
[alias]
  wdiff = diff --word-diff=color --unified=1

三 在自己的git仓库根目录新建 .gitattributes 文件

// 内容为
*.doc diff=pandoc
*.docx diff=pandoc

ok 实验一下,大功告成

相关文章:

  • 2021-12-09
  • 2021-07-21
  • 2021-10-11
  • 1970-01-01
  • 2021-11-02
  • 2021-08-02
  • 2022-12-23
  • 2021-08-09
猜你喜欢
  • 2021-06-02
  • 2021-04-19
  • 2022-12-23
  • 2021-11-28
  • 2021-12-22
  • 2022-12-23
  • 2021-09-30
相关资源
相似解决方案