how to share odt/doc documents over git

别等时光非礼了梦想. 提交于 2019-12-04 03:10:22

Have you considered using LaTeX instead of doc or odt? This way you can edit the documents with any text editor and get good looking results. Better yet: you have proper diffs between revisions (no matter the SCM you use).

If you don't like the idea of editing the document in a simple text editor take a look at LyX. It provides a gui for editing documents like you would get in normal document editors.

For git hosting solutions you can use:

  1. github (if your documents are open-source, which I don't think)
  2. bitbucket (offers unlimited repositories, with unlimited space and up to 5 users for project)
YurB

There are two tools which can be used to let git diff odt files: odt2txt and oodiff.

See this resource for details on how to set this up (also includes information on Mercurial and SVN.)

Snippet of above instructions (for git >= 1.6.1):

  • First, install odt2txt, and configure git to allow it to run it, by adding this to ~/.gitconfig:

    [diff "odf"]
          textconv=odt2txt
    
  • Now, for each project, you just need to ask git to use this driver in .gitattributes or $GIT_DIR/info/attributes, like this:

    *.ods diff=odf
    *.odt diff=odf
    *.odp diff=odf
    

LaTeX is perfect for combining it for git. But if you cannot afford yourself the time to "translate" all to LaTeX, I think a great option that fits your needs is using LibreOffice and saving files in .fodt format (Open Document Text - Flat XML). These files are uncompressed XML, so you can use all the power of git as you can see addition and changes to the document line per line.

This will make merging an easy task. Even binaries (e.g. when you include an image) will be embedded in the document and shown as text. Of course you cannot manipulate them from there but you can remove the whole tag or edit attributes with the simplest text editor.

You can use LaTeX for text documents with format (or rtf, Rich Text File, if you prefer a method accesible to anyone), and fods for spreadsheets.

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!