Nice R Code

Punning code better since 2013

Introduction to version control using git

Version control systems (VCS), which have long been used to maintain code
repositories in the software industry, are now finding new applications in
science. One such open source VCS, git, provides a lightweight yet robust
framework that is ideal for managing the full suite of research outputs such as
datasets, statistical code, figures, lab notes, and manuscripts.

Using a good version control system, such as git, is probably the most important habit you need for writing nicer code. Below you’ll find the nicercode guide to version control using git, written especially for ecologists who haven’t used other version control systems before. (We’re using “ecologists” as a shorthand here. It’s not an exclusive term – many geneticists or other scientists will have the a similar background, toolset and needs.)

  1. What is version control and why would you use it
  2. Workflows that use version control
  3. Overview of git system
  4. Digression: setting git up
  5. Version control from within RStudio
  6. Digression: a 5 minute intro to the shell
  7. Version control basics
  8. Branches, and why you would use them
  9. Remotes: keeping your work elsewhere

Other resources

There are many other tutorials and resources about git. Here we are a few

You may also be interested in these blog posts and papers, discussing the use of git in science