--- layout: post status: publish published: true title: Using git in my writing workflow wordpress_id: 2808 wordpress_url: https://www.martineve.com/?p=2808 date: !binary |- MjAxMy0wOC0xOCAxNDo0NTo1MiArMDIwMA== date_gmt: !binary |- MjAxMy0wOC0xOCAxMzo0NTo1MiArMDIwMA== categories: - Technology - Academia tags: - Writing - git comments: [] ---
My two spheres of interest -- difficult works of English literature and computer programming (OK, scholarly communications and publishing, also. OK, there are lots more spheres of interest) -- only intersect occasionally. However, in recent days I have been toying with the idea of using git to version control my writing. This isn't a new concept -- I've seen posts on the Chronicle of HE about it -- but I've yet to actually try it.
I think I first heard of git for academic writing through Newell Hampson-Jones on Twitter and, I'm sorry to say, I was dismissive and sceptical. I struggle to remember what my exact thought process was, but I suspect it came from a viewpoint overly determined by the single-author model. I seemed unable to envision collaborative writing with git (mostly because I knew that Word and OpenOffice would yield blobs) and I also hadn't thought through how git could be useful to version both published artefacts and also my own internal versions. Bizarre.
Anyway, my current versioning system for documents is fairly horrendous. Every day I save a new file:
2013-08-18 - Document.odt
This means that, over the course of a book, I end up with a massive folder with a uniquely named version for every day's worth of work. This is all well and good, but it's clumsy.
Anyway, I'm going to try my next article with a git repository and wanted to share some setup tips.
First of all, please remember that git IS NOT github. Github is a web viewing service and collaboration facilitator for git repositories. I'm intending to work with local git repos as I'm not (yet) confident enough to publicly push my work in its versioned states (and I'm not sure anybody would be interested).
In any case, the key thing that will make this viable for me is having a way to see the diffs within an OpenOffice (or LibreOffice document), so I want to share how I've got that working (I'm using Linux Mint).
As per the gittips wiki, I added the following to ~/.gitconfig
{% highlight bash %} [diff "odf"] textconv=odt2txt {% endhighlight %}and ensured I had installed the odt2txt package ("sudo apt-get install odt2txt").
Then, once you've initialised the repository in the working directory for your new writing ("git init"), add the following to that repo's .gitattributes file:
{% highlight bash %} *.ods diff=odf *.odt diff=odf *.odp diff=odf {% endhighlight %}Now git should be able to display the difference between commits in OpenOffice documents.
From there, I'd recommend gitk as a visual tool to see the diffs, but otherwise, I'm good to go!