How to perform better document version control on Excel files and SQL schema files

前端 未结 9 1248
执念已碎
执念已碎 2020-11-27 09:29

I am in charge of several Excel files and SQL schema files. How should I perform better document version control on these files?

I need to know the part modified (di

9条回答
  •  抹茶落季
    2020-11-27 10:08

    The answer I have written here can be applied in this case. A tool called xls2txt can provide human-readable output from .xls files. So in short, you should put this to your .gitattributes file:

    *.xls diff=xls
    

    And in the .git/config:

    [diff "xls"]
        binary = true
        textconv = /path/to/xls2txt
    

    Of course, I'm sure you can find similar tools for other file types as well, making git diff a very useful tool for office documents. This is what I currently have in my global .gitconfig:

    [diff "xls"]
        binary = true
        textconv = /usr/bin/py_xls2txt
    [diff "pdf"]
        binary = true
        textconv = /usr/bin/pdf2txt
    [diff "doc"]
        binary = true
        textconv = /usr/bin/catdoc
    [diff "docx"]
        binary = true
        textconv = /usr/bin/docx2txt
    

    The Pro Git book has a good chapter on the subject: 8.2 Customizing Git - Git Attributes

提交回复
热议问题