At the start of my writing sabbatical a few months ago, I realised that I needed to preemptively address the issue of file versioning and change control before I had written too much. That lead me to examine how I was going to work and what programs I was going to use to make my life easier and more secure.
The resultant toolset and workflow I’ve cobbled together is not that unique really. It’s not that different from any normal developer who codes primarily on a typical Linux box. The main reason I’m outlining it here in a blog post is in case anyone other writers out there perhaps find this information useful.
This isn’t exactly a ‘Git for Writers’ post, but it is inspired by that basic idea.
I’m going to outline the programs and processes I use during the different phases of my writing workflow, with comments and descriptions where necessary.
Writing Software (Word Processing)
gedit — My primary computer runs Xubuntu and my main editing app is gedit with a few useful plugins:
- Document Statistics (installed by default) — useful for word count
- Spell Checker (installed by default) — don’t leave home without one
- Regex Search and Replace — when Search and Replace is not powerful enough
- TabSwitch — because I hate not being able to Ctrl+Tab to other tabs
notepad++ — When I have to work on a Windows box I pretty much just use notepad++.
LibreOffice — I really only use LibreOffice for creating DOC and PDF files.
This may be reversed for many authors but I write in basic text editors and then copy/paste my documents into LibreOffice when I need a .doc file.
The first reason I use a vanilla text editor is plain, old comfort. gedit has all the features and shortcuts I require, and I can work in it quite quickly.
I also don’t require any of the typical text formatting that a word processing program like LibreOffice can offer during my writing phase. Most of the text formatting I do comes during the output phase of my workflow, since I have to format documents not only for DOC and PDF but also EPUB and MOBI.
Authoring in plain text also makes file versioning and change control a no-brainer.
File Versioning (Archives and Backups)
Git
Versioning offers an easy solution to managing progressive versions of any file, as well as robust archives and backups. And since I’m used to versioning from my development background, opting to go this route was an obvious choice for me.
After considering my options, I went with Git. I hadn’t used Git before but its features and ease of use ended up being a natural fit for my workflow. If I had to work primarily on a Windows box and absolutely needed a GUI (instead of the command line) I probably would have went with SVN and TortoiseSVN which I have used before numerous times.
Git Instances
Besides running a local install of Git on my Xubuntu box, I also have a private Git repository hosted in a subdomain on my production server (on Dreamhost) which I can access easily using SSH. Both instances are running the same version of Git as well.
The beauty of this setup, to my mind, is that I immediately have two separate repos of all my work. My main working repo is on my laptop, and the server repo doubles as a backup as well as the master repo access point for when I sometimes have to work on a different computer.
For those times when I find myself working on a Windows box I use the portable version of Git from mysysgit.
Git Commands
I basically only use five commands when I am writing.
git status — to check if any files have been modified
wc -c filename — not a git command, of course, but lets me know the wordcount of any file (this is useful to me since I set myself a quota of words to write per day)
git commit -a -m "your message here" — commits all modified files to the Git repo
git push origin master — pushes the local repo changes to the server repo
git pull origin master — pulls the remote repo changes to your local repo
The sixth I use sometimes is:
git log -n 1 — displays the last log entry in the command line, for when I haven’t pushed my most recent commits to my server or I’m too lazy to bring up Gitweb
Gitweb
The subdomain on my live server is also running an instance of Gitweb. I had to setup gitweb myself since it’s not installed by default on Dreamhost, but it was relatively trivial to do so. I followed the basic outline in “Step 4. Setup GitWeb (optional)” of this excellent blog post to get it up and running.
I actually end up using Gitweb quite frequently to get an easy to read display of my Git log. It also gives me easy access to my files in a browser if I need to show someone a snippet of what I’m working on.
Because the raw file view in Gitweb does not line wrap by default, I also use the Toggle Word Wrap add-on in Firefox when I want to read a file. It basically puts <pre> tags around plain text, which is great.
Git Commit Messages
One of the many useful things about versioning is the ability to include a message when committing any files. In addition to whatever message I include with a commit, I have a simple commit hook which outputs the word count of any file that’s been changed, and also includes the title and artist name if I’m playing any music at the time. I’m no bash jockey but I was able to cobble together a basic script that satisfied my needs. Check out this blog post to see the entire script.
Ebooks and Ebook Formatting
I am specifically writing with ebooks as a default file format in mind. Once my current stories are ready to go I plan to self-publish them online (on Amazon, Smashwords, and other sites) and perhaps even through POD (print on demand) services. So, anything I can do to make converting my text files into well-formatted ebooks helps reduce my time and effort. I love monkeying around with code, but ultimately I want to spend most of my time writing.
Using a combination of ‘Find and Replace’ and regular expressions, and a few other tricks, I can relatively easily convert my plain text files into ebooks (HTML and CSS) or a DOC file.
For me this mostly involves converting italics, dashes, ellipses and quotes, adding indents or altering whitespace, etc. to suit the desired file format. (I plan to make a more detailed post on my formatting process soon.)
I also wouldn’t be able to create and convert ebook formats anywhere near as easily or quickly if it wasn’t for Calibre. It is a superb program and I am immensely grateful that it exists.
Ebooks and Self-Publishing
And for anyone interested in self-publishing online, Joe Konrath’s blog, ‘A Newbie’s Guide to Publishing‘ is highly recommended.