21

LibreOffice saves into files that are zip files. Zip files are generally suboptimal to use with Git: A small change in the document can change most of the zip-file, thus making it impossible for Git to reuse parts which results in the Git repository grows with the full size of the zip file instead of just the few changes.

Is there a way in which I can tell LibreOffice to save in a Git friendly format?

E.g. by saving as a zip file with no compression (ala .tar) or simply saving the document as a dir containing the same files as the unpacked zip file would result in.

22

Is there a way in which I can tell LibreOffice to save in a Git friendly format?

You can save your files as flat XML (fodt) instead of odt:

If a document is saved as .fodt file it keeps the same data the .odt file would contain. Only that this time the data is represented as human-readable text (which makes the work much easier for the version control system) and not compressed. So saving a document as flat XML makes it possible to keep server space requirements and network load low at the relatively low cost of wasting a few kilobytes on the local hard disks.

Source LibreOffice and Version control


Further Reading

| improve this answer | |
  • The option discussed in the last link (to add newlines) appears to have been dropped in LO -- I can't find it in the Load/Save settings. – retorquere Apr 7 '18 at 7:55
  • @retorquere Indeed. Looks like it was removed. Answer updated to remove that link. – DavidPostill Apr 7 '18 at 15:17
0

I have written a bash script that enhances Libreoffice docs into git friendly format - see https://github.com/timwiel/libreoffice2git

| improve this answer | |
  • 1
    Can you compare how the space performance differs from using .fodt? – Ole Tange May 20 at 12:38

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.