Skip to main content

The proper use of version control is one of the foundational aspects of best practices. Version control facilitates working as part of a team so that code can be reviewed, integrated, and modified in a safe and sensible way. For the individual, version control greatly reduces the risk of lost work, and it makes it much easier to work on multiple devices (desktop, laptop, etc.) while minimizing the risk of working on outdated code. This short guide is intended for a student working on a one-person project in our consulting class.

I recommend the use of GitHub (www.github.com) for this purpose, although there are other good solutions available, too. Students and faculty should apply for the educational license and get the developers pack. Most people will find GitHub Desktop the easiest way to manage their files. More advanced users can also use an extensive command line interface.

Here are some general guidelines:

1. Create a private repository if you are working with a collaborator.

Assume that the data and your work are confidential unless you have agreed otherwise with the collaborator.

2. When you share with someone else, remind them that they need to be logged on to GitHub in order to accept the share.

3. Follow the virtuous cycle:

Fetch/Pull –> Work –> Commit and comment –> Push

I generally recommend doing this after every time you touch the repository, regardless of the amount of work done or your satisfaction with the quality of your code or completeness of the results.

Some of the benefits of this approach:

* It is easy to work across different machines, e.g., your laptop and your desktop.
* It is easier to work as part of a team.
* You won’t lose your work if something happens to any particular computer.
* You can more easily recover from any mistakes you might make in managing your files or your code.