Shoestring Psycholing

A language science blog

Getting on With Git

Back from a long hiatus, aiming for shorter posts.

Git really is great. I’ve been thinking about it for a long time, and I went through a period early this year in using it regularly while working on some personal projects, but then I stopped for a while, mostly because I went back to the office, where (I assumed) we didn’t have it.

Git is a type of version control software. For those of us who aren’t software developers by profession, this basically means that git is a kind of file management system that works like a combination “track changes,” “undo button,” and all-around time machine for an entire project. I’m more and more a believer that some kind of good version control is realy the foundation of reproducible research. More on that in other posts.

But finally it occurred to me that since git is used for Linux development, it would be a pretty common part of most Linux distributions (yeah, I’m a slow one sometimes), and lo! and behold! there it was, sitting on our Linux server at work all this time. Of course by then I had fallen off the wagon, and it took me a while to get going again.

But NOW… I’m starting to get religious about it again, and loving it. And I took another step, getting some private repos on GitHub, and actively using these to access my work in multiple locations. So far it’s really worked beautifully. Here are a few lovely moments:

  • I had a paper I was working on, and I wanted to try out two alternative analyses. I created a “branch” for each of them, and using the magic of git, I could swap between them, without needing to create confusing, parallel sets of files.
  • After coming back to this paper after months of being stalled, I decided which branch I wanted to move forward with, and with a simple git merge command, it merged seamlessly into my main branch, and I could just move on.
  • I ran a little not-quite-one-hour tutorial session for some friends at work, and that was enough for many of them to be excited and feeling ready to start using it themselves. This could mean that git is the absolute most bang for the buck in terms of time invested and returns gained in reproducibility and security of one’s research.
  • For the projects I’m working on at home and in the office, for which I can push things to GitHub, I never have to wonder about where the most recent version is. Just a simple git push or git pull, and things are up to date.
  • Working on a draft, I was editing various things, cutting some stuff, adding other stuff. Finally, a few versions later I had something all ready to share with my co-author, when I realized that at some point, I had mistakenly deleted half of my opening paragraph. All it took was a quick git checkout of a previous commit to pull up an older version with the intro still intact, copy that text in Emacs, git checkout master to revert back to the up-to-date version, and then paste in the text. Easy, fast, beautiful.

I’m a fan!

If this sounds intriguing, check out my (in progress) tutorials on getting started with git (aimed at non-programmers, especially academic researchers). Feedback welcome!

Comments