I have independently investigated a bit into Scrivener and Git. See over here: http://www.mnott.de/unscrivening/. I’m a Scrivener novice, and just had done some scripting around it to make it work faster and more flexibly with LaTeX (http://github.com/mnott/texdown). So I got to look into the data structures, and I think, the issues are really somehow these:
- Because Scrivener uses all files in one folder, and you can have naming conflicts in Scrivener (and it makes sense to allow for them), some scripting needs to be done to export the Scrivener (.scrivx) path into a Filesystem path, if you want to later get the content back. I think this can be done.
- Because Scrivener uses RTF, diff is easy, but merge is not, on file level. It is potentially possible to work around that, using html or similar as intermediate format for maintaining the formatting, plus plain text for being able to merge, but it is not quite simple. I think this can be done, and if allowing for some loss (which should be fine for LaTeX folks, who do mostly annotative writing), then that may even be a viable option.
- As others have mentioned, even if you solve merge, you’ll have an issue with creating - or concurrent creating - of files. There are actually unique IDs in .scrivx, but I’m not quite sure at this moment how they are calculated. This, at least, would allow us to get away from sequenced numbers.
Now, with that, while I’m a big fan of Git, I think there’s upside potential by doing some more scripting on Scrivener itself. For example:
- Essentially, add a management command line interface. Very much, my little TeXDown script that I started a couple days ago to have my own markdown for LaTeX, and a faster compilation of assets, has already somehow gone beyond its purpose and is doing some management stuff.
- Allow for taking snapshots of stuff from the command line - and for managing them. After all, merging stuff back in, and the “new document added” problems could potentially be solved if rather than adding stuff in all the time, we would just add new stuff in, but other than that, would just re-import stuff as explicitly named snapshots - and then use Scrivener UI to make sense of the changes. I think this can easily be done.
- Allow for exporting parts of .scriv into other files, again from the command line. And for re-importing them.
Essentially, all my focus is on scripting because I know if I’ve scripted it, it just works. If I’ve to remember which stuff to select in the binder to then take a manual snapshot of, I’ll make mistakes.
Fundamentally, Git can not only be used as a direct tool, but also from an API perspective. Just watch this video to see what the OmniFocus people are doing: https://realm.io/news/altconf-wil-shipley-git-document-format/
While I highly like that Scrivener has a very plain text format for most of its assets, I think following that more clever Git route that the Omni people do would add significant potential above and beyond what users like me can do.