Text Files
Git, like most source control programs, has been written around the idea of “source files”. For most writers, the source is a .docx
or an .odt
file. For those who use Scrivner, the extension is .scriv
. The main thing about these files is that they are binary files and using those loses a lot of the functionality of Git. Instead, the preferred format is a text file.
There are a lot of advantages to using text files to write.
- It is very difficult to corrupt a text file
- Text files are fast
- Legacy file formats
- Almost any program can be used to edit them
- You can use tools to process them
There are some serious drawbacks also:
- You have limited formatting options
Corruption
This is one of the main reasons I switched to text files. Over the years, I did a lot of work with Microsoft Word, StarOffice, OpenOffice, and then LibreOffice. I've even used Google Docs and a few online variants. At a certain point, they seem to corrupt on me. I've lost 100k word novels and struggled to recover them. I ended up writing tools to help with the recovery process of the later formats, but it was frustrating.
Text files are very difficult to corrupt because they are just that, text. You can use type
or cat
to view them, you can open them in Notepad++ (or Notepad or TextEdit) or just about any other word editing program in existence and it just works.
Performance
Another part is that because text files are so simple, they are fast. I don't know about you, but when I used to write a novel in a single file, it got tedious scrolling through hundreds of pages while Word tried to tell me which page I was on. That is because many word processors, such as Word and Docs, are actually low end publishing programs, not writing programs.
Text files are just a string of characters in a file. There isn't much more to that and most editors don't need to do anything fancy with them.
Legacy File Formats
I create my first collection of poems in 1991. I used Microsoft Word on the high school's Macintosh computers. While I think I still have the files hanging around, I don't think I have a program that can actually open them. Hundreds of poems in two collections and I'm not able to access them. This is quite distressful but it also points out, that a binary format such as Microsoft Word changes over time and thirty years later, you might not be able to open it.
Text doesn't have that problem. For most part, I can open a text file I wrote in the 1980s and it still works. My dad had files from the 1970s that I was able to browse through.
It doesn't seem like much, but once you finish a novel, you may not go back to it for years or even decades later. What was state of the art then may not be the case now and technology may have changed to the point those files are lost.
Editing Programs
Because text files are so simple, there are a lot of program that can be used to edit it. I started seriously writing using Emacs, I have used Notepad++ and Neovim. Eventually I went all-in with Atom but that was cancelled by Microsoft. These days, I use Visual Studio Code but I also will quickly start up Neovim to do a quick edit.
As long as there are programs, there will be text editors that can open the file.
Tools
The other advantage is that there are a lot of programs that can be use to manipulate, query, or alter text files. I can use a program like wc
to count the words in a chapter, or grep
to find a phrase, or more complicated ones that do analysis on my words.
Formatting
One beauty of Microsoft Word and related programs is that they are also publishing programs. That means you can see how a chapter fits on a page, add headers and footers, style it, and generally work on how it “looks” instead of the “content” of the page.
Text files struggle with this. With formats like Markdown, some styling can be done but not at the level that Word can duplicate. Not all authors like that; my father struggled with text-based formats because he wanted to tweak the locations of his images and spent hours trying to find the perfect line and word spacing to make each paragraph beautiful.