Git 倉庫中保存 word文檔

git 默認只會git diff 文本文件,不能對doc、docx 文件格式進行diff,因此須要用到特殊的工具將doc、docx格式的word文件轉換爲文本格式。 這兒用到的工具是pandoc

一 安裝 pandoc

pandoc下載地址 , 直接下載安裝就能夠了。html

二 須要更改 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 實驗一下,大功告成

相關文章
相關標籤/搜索