Track your changes

You already track changes to Word documents. You should also track changes to your code and data work. Learn how to use git and start using it as soon as you start writing code. Even in the unlikely case that you never need to go back and check previous versions of your files, it will still give you the peace of mind of knowing that if you break or erase something important, you can always go back.

There are many version control systems, but some are clearly better than others. Using file names to track changes, for example, is better than not tracking them at all. But that can get unwieldy very quickly. Git is the version control system most widely adopted among coders. It allows you to track changes to any plain text files, save incremental changes to your work, and compare different versions. It also creates incentives to document your work through commit messages. When combined with a hosting service like GitHub, it creates a workflow for multiple people to collaborate on a project simultaneously without breaking each other’s codes, transfer code to different machines, track tasks and write documentation. We recommend using GitHub to track changes to metadata (through codebooks), tables (by exporting them to plain-text files such as .tex and .csv), and figures as well as code, so you always know how changes in the code are affecting its outputs.

Writing meaningful commit messages Using branches for simultaneous collaboration Using GitHub for cloud syncing Using GitHub issues to track tasks About GitHub wikis Tracking changes to images

Next section