Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

how to share odt/doc documents over git

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?

like image 208
MhdSyrwan Avatar asked Jan 09 '12 21:01

MhdSyrwan


People also ask

What is ODT attachment?

What is an ODT file? ODT files are type of documents created with word processing applications that are based on OpenDocument Text File format. These are created with word processor applications such as free OpenOffice Writer and can hold content such as text, images, objects and styles.


2 Answers

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
    
like image 132
YurB Avatar answered Oct 19 '22 16:10

YurB


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.

like image 30
froskos Avatar answered Oct 19 '22 18:10

froskos