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.)
- What is version control and why would you use it
- Workflows that use version control
- Overview of git system
- Digression: setting git up
- Version control from within RStudio
- Digression: a 5 minute intro to the shell
- Version control basics
- Branches, and why you would use them
- Remotes: keeping your work elsewhere
Other resources
There are many other tutorials and resources about git. Here we are a few
- We recommend chapters 1-3 of the excellent git book
- git succinctly, another free book.
- Documentation on the official git site, or git reference site
- Git Immersion.
- The Rstudio intro to version control
- Wikipedia’s entryabout git
- Some other tutorials: http://sixrevisions.com/resources/git-tutorials-beginners/
- A detailed lecture by Scott Charcon about github, an site for hosting git packages
- A list of graphical git programs
You may also be interested in these blog posts and papers, discussing the use of git in science
- Another talk on git for scientists, by Karthik Ram
- Ram (2013) “Git can facilitate greater reproducibility and increased transparency in science” Source Code for Biology and Medicine 8:7
- Rogers (2013) “The GitHub Revolution: Why We’re All in Open Source Now” Wired Opinion