4

I want to write eBooks using Git as version control software. Since neither Git supports .epub files (at least not diff-able) nor Sigil or Calibre supports any kind of using an eBook as "project" (folder with containing files), I wanted to ask you how I could achieve this, if it's possible at all. Since an .epub file is nothing more than a collection of folders and files, I don't see any problems with this, but I just can't find anything on Google...

Edit: Since I rather work with HTML and CSS files, I created my own solution for this problem: With EpubCreator you are now able to place all your .epub files into the src/ folder. As soon as you want to view your work up to now, you just can run the index.php script, which will in first instance assemble an .epub file from source and save it into the bin/ folder. After that, it will call the just created .epub file and display it in your browser. It should then look like this: enter image description here There are now plugins or so needed, the displaying is achieved with epub.js, another project on GitHub (if you are interested, it is linked in the LICENSE.md in my project). I hope this helps anybody. Also, as I often make ebooks, I will keep on with the work. This is now about 6 hours of work, I hope I will be able to improve it a lot. Thanks for your tips and inspiration.

CharlyDelta
  • 938
  • 11
  • 31
  • What file format does your writing process use? – mwu Mar 23 '14 at 02:57
  • 1
    Good Q. VonC answer is probably the option. Similar quest on my part, I wanted to edit with a track-change environment. I almost set up MediaWiki with this extension http://www.mediawiki.org/wiki/Extension:EPubExport I would edit an "article" like it was a Chapter or Book. I never did try it. – Paulb Mar 25 '14 at 11:12
  • Thanks four your replies. @mwu I don't understand your question. What do you mean with writing process? I am writing .html and .css files with Sigil, which immediately creates an .epub file if you save it. – CharlyDelta Mar 26 '14 at 09:35
  • @Paulb Well, that will export an .epub file, if I got you right? I'm not sure how this could help... – CharlyDelta Mar 26 '14 at 09:36
  • I had an idea reading your answers, thanks again! I updated my question and you will be informed as soon as I got it running like I wanted it ;) – CharlyDelta Mar 26 '14 at 10:01
  • I updated my question with another solution for the problem. Thanks everybody again – CharlyDelta Mar 27 '14 at 22:42
  • The links in the question and answer are no longer live, but this is likely a relevant question: https://stackoverflow.com/questions/8001663/can-git-treat-zip-files-as-directories-and-files-inside-the-zip-as-blobs – Herbert Van-Vliet Sep 28 '20 at 08:09

1 Answers1

3

It is best to write your book in a text format (that Git can easily stored), and generate the target format from those sources.

The article "Publishing eBooks with AsciiDoc" illustrates that process, using asciidoc format (text) to generate epub.
It uses the a2x toolchain manager for the generation:

a2x -fepub -dbook minimal-book.txt
VonC
  • 1,262,500
  • 529
  • 4,410
  • 5,250
  • Thanks for your response. I will take a look at it. If it helped, I will let you know, but it sounds good. I just need to find out if this also can be used with .html and .css files, since I'd rather use these languages instead of yet another markup language – CharlyDelta Mar 26 '14 at 09:39
  • 1
    I accepted this answer now, since it theoretically can perfectly solve the original problem posted, but for those who want to use HTML and CSS like me, I will update my question with another solution – CharlyDelta Mar 27 '14 at 21:25
  • for text to epub that looks fine. What about graphics? – Thufir Mar 26 '18 at 17:44
  • 1
    @Thufir 4 years later, I am not sure. – VonC Mar 26 '18 at 18:31
  • 1
    @Thufir Graphics are binary files. Git handles those just fine, but no granular diff. – Herbert Van-Vliet Sep 28 '20 at 08:08