how to share odt/doc documents over git

7.9k views Asked by At

The idea is that I want to share and track documents over git

I thought about using Text Documents (markdown docs that look like docx,odt in functionality) that can be edited with any text editor (not binary). Where to find something like this?

any better solution?

4

There are 4 answers

5
Igor Popov On BEST ANSWER

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)
0
Ariel Sebastián Becker On

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.

2
froskos On

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.

1
YurB On

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