Git for writers: Write fiction like a (good) programmer
An introduction on Git as a writing tool
As a front-end programmer who also writes fiction I can imagine a lot of tools for programming which would be very convenient for writers. But the primary and most important tool I want to talk about is Git. For those who don’t know what the hell is this, I explain: Git is a a version control system. It controls drafts and versions of files (so, text files included here). It is very useful while someone writes code for a new program , since there are many versions of the same code and the programmer needs to keep track of each one of them. Sometimes the person wants to merge versions, for example. And believe me, when you program you have many versions of the same code and the stupidest thing is to save new files for each new version (it seems the natural way to manage a project but it is not). Some codes are so big that is impossible to track everything manually. And they take a stupid large space in your HD. (Git is also helpful to write texts in group, but it is a subject for another post).
Doesn’t it sound similar to a writer’s routine?
This autumn I’m doing the NaNoWriMo contest and started to write three stories simultaneously rather than the usual one novel. Soon I noticed it was turning into a hard task managing all my drafts, revisions and research files. Some authors were talking about Scrivener on Twitter (a word-processor program designed for authors) and it seemed to be a good application for me. I decided to test it and quickly understood I found my favorite word-processor for writing novels, tales or screenplays. It works very well in my Fedora 21 running a supposed unstable experimental version of Scrivener. But I was not afraid of it. Then I started to think how I could protect my work from this volatile ‘program-child’ while using its delightful features. Coincidentally, I was finishing an easy Git challenge that day (did you notice how much I appreciate and get myself into challenges?) and realized that Git was the answer to my latest writing needs.
Why?
Since Git is a tool to control drafts and resources in a directory, to make infinite versions of it and allow merges while keeping its original (or main) version, I think it is the writer’s best friend. You can keep many versions of your novel or watch the process you took while writing. It is amazing.
And Git is an open source project, made by the same guy who created Linux, Linus Torvalds. Why is open source so important? Well. For example, it allows the existence of two great projects, GitHub and BitBucket, which you can use as your own ‘cloud’. And yes, I mean: backups. Free backups.
Nice, but… how does it work?!
First of all, keep this in mind: Git is a software. It manages files as they change by time.
When you install Git in your computer, you must initialize it in a directory. The directory, where your files are located in, is the so far know repository or just repo. Our repo contains everything we create and update with git. It is our project. Now you ask: so what? Well, now the magic happens.
Using a git repo allows you to make many versions of your work and smartly keeping track of the changes in each version you work in.
Every time you update a file you must tell git about it. Don't get me wrong, Git already knows that you've changed something in your project, then you need to tell it what was that changed. This is kindly called commit. And you always finish a commit with a comment. Yes. The comment doesn’t appear in your document, relax. It stays only in git registration. You must tell something about every change you make in your file, in every commit you make. It doesn’t matter if it is a simple ‘changed the paragraph from past continuous to simple past’. Or even a ‘ character Mary added up to the dialogue in scene 2’. I recommend you to write something short but highly and quickly understandable. So your commit has always its own ID and you can track it easily. Commits are very very very important as you can return to the point you made a commit or you can mix commits. A whole new world of options.
Imagine your repo as a tree. Your trunk is the master. Then you can create branches in your master, and every new branch has its own purpose.
For example: I can create different ends for my novel, and each new outcome demands little changes in my plot. I can create a branch for each new version of the story and make as many modifications as I need. Then I can merge some interesting points trough my branches if I want to match them. I can split each commit of each branch I want to merge and read how they work together in the final text without lose everything I’ve made separated before.
We use Git to make all this without getting dirty hands. Because Git builds it programatically for us.
Git allows us to make a lot of useful things. I can sit here and write for hours about it, but for now I’m planning a set of articles to help people how to ally technology and literature in a balanced way. So, this short example may work as a beginning for someone who has never heard about Git before.
How can Git help me with the backup stuff?
You can easily use Github or Bitbucket as repositories and sync your local repo with their remote. They are websites that run Git behind the scenes. You create an account with one of these services and use it in the same time you update your novel. Don't worry. I’ll show you how to do this in next articles.
Next steps
I hope you understood the benefits of using a programming tool to write texts. If you have any question about anything, please, write me (no pun intended).
I’ll post more articles about Git and its uses in practice. :)