Version Control for Fun and Profit

Keep­ing track of old ver­sions of your work is one of those things you don’t appre­ci­ate until you have it. Most peo­ple keep old ver­sions with a mish­mash of file names (novel.doc, novel-backup.doc, novel-backup2.doc, novel-backup-september-2015.doc, …) or using a ser­vice like Google Dri­ve or Drop­box. These solu­tions work but to say they’re lack­ing is an under­state­ment. Enter git.

Git is a piece of soft­ware used to track his­to­ry of source code. While it’s fine-tuned for this behav­ior it’s still phe­nom­e­nal at track­ing changes in projects that are struc­tured sim­i­lar to soft­ware. If your project has the fol­low­ing prop­er­ties git makes an excel­lent choice:

  • work is stored in plain text (i.e., non-bina­ry files)
  • files are small to medium-sized
  • files are human-readable

Since I use LaTeX all these con­di­tions are met (most word proces­sors have an option to store con­tents in flat files which gets you most of the way here).

So how use­ful is git? Think about the back­ups spread across dif­fer­ent ser­vices and fold­ers with God-only-knows what names. Count how many you have and com­pare it to the his­to­ry of my project. 

$ git log --oneline | wc -l
177

177 ver­sions at the time of this post, all of which are time-stamped with meta­da­ta about what actu­al­ly changed. The last two com­mits look like this: 

commit 42bf73d45dfe7fea13996ef9e3b2cdd0e122dc0a
Author: K.P. Wayne
Date:   Sun Jan 29 20:02:52 2017 -0700

    Polish up first part of chapter 1 using Pro Writing Aid

commit 297b676edc97643f901be6f6d0f846546534f2d5
Author: K.P. Wayne
Date:   Sun Jan 29 18:54:26 2017 -0700

    Work in feedback from Scribophile

Not only is back­ing up off­site triv­ial, but each back­up con­tains the entire his­to­ry of the project. As of right now my entire repos­i­to­ry, mean­ing the full his­to­ry of my project, is a whop­ping 652 kilo­bytes; less than half the space of a flop­py disk.

You can also mark spe­cif­ic ver­sions with sym­bol­ic names (the git term for this is a tag). This makes it triv­ial to see what changed between two dif­fer­ent versions.

git diff –col­or-words scrib-bk1-a01..master bk1/A‑01mine.tex

In fair­ness git has a learn­ing curve and last time I checked most gui tools ranged from awful to bad (cowork­ers assure me this has changed). A sim­pler option is mer­cu­r­ial and Joel Spol­sky put togeth­er a sim­ple tuto­r­i­al for any­body unfa­mil­iar with ver­sion control.

It’s not for every­body and I haven’t test­ed git with pop­u­lar tools Scriven­er but if it fits in your work­flow give it a go.

2 thoughts on “Version Control for Fun and Profit

Comments are closed.