
## 安装 pandoc

[安装教程](http://pandoc.org/installing.html)

[Pandoc User’s Guide](http://pandoc.org/MANUAL.html)

```bash
# macos 
brew install pandoc
# debian
sudo apt install pandoc -y
```

### 修改 gitconfig 文件

创建或编辑 `~/.gitconfig (linux, Mac)` 文件，添加如下代码

```toml
[diff "pandoc"]
   textconv=pandoc --to=markdown
   prompt = false
 [alias]
   wdiff = diff --word-diff=color --unified=1
```

### 编辑 gitattributes 文件

在 word 文件目录创建或编辑`.gitattributes` 文件，添加如下代码

```toml
*.docx diff=pandoc
```

### commit 后命令查看 word 修改

```bash
git wdiff file.docx
```

查看所有修改

```bash
git log -p --word-diff=color file.doc
```

