Using Git to write papers

I have been using version control to write my papers for a long time now. I started off using CVS then moved to SVN and now have switched to Git. Though SVN was a little simpler at time, I am happy with my move to  Git.

The basic idea is that there is a server in mathematics holds copies of my papers and all of the changes I have made and committed to the repository. When I go to any of my computers, I just tell it to update to the latest version of the paper. I then can edit it local committing changes as I go. These commit points serve as milestone to which I can return too at any point. Say I think I have a cleaver proof which will simplify my main argument. I start changing the paper only to realize after an afternoon of editing that there is an unintended consequence and I which I had not made all of the changes I did. With a simple command line, I can return to the state the paper was in earlier in the morning. Gone are the endless number of “numbered” versions sitting in the directory. I no longer return 6 months latter trying to recall which was the version I submitted.

While his “versioning” is nice, the real advantage for me is that when I have co-authors everyone can edit the paper at the same time. In the beginning, we should each work on different parts of the paper. Git will merge the sections together effortlessly. Once the paper is mature and we are making smaller edits, we can both roam over the whole paper. On the odd chance that we edit the exact same section, Git will alert me to this and give me a chance to merge the two edits by hand.

As an added benefit, all of my papers are back up with extreme redundancy because of git and I never worry about loosing them. Since I update the directory before I start working, git is also a way to synchronize all of my computers.

I use git even with people who don’t. Some of my collaborators don’t like change or “complicated new ideas” as one put it. Git lets me maintain different branches. I create one for each co-author. I send them the version form there branch and tell them to edit the text. I continue editing my branch (without telling them). When they send me back a version, I switch to their branch and commit the version they sent. Then I merge their branch into mine, thus combining our edits.

How do I use it. The mathematics department runs Gitlab to manage Git repositories. It is a nice easy system for adding users to a project and changing who can edit/see a given paper. I have written a number of pages about how I use git in general, how to set up new repositories, and how git is used for the Math Everywhere class in particular.

I mainly use the command line to manipulate git. However I also sometimes use the free software package called Sourcetree. It is particularly nice to track changes. When I want to find an old version before I mad certain chances, this is how I do it.

Leave a Reply

Your email address will not be published. Required fields are marked *