Version Control¶
Version control is the management of changes to large projects, including the development of computer codes, the collection of data and information, and the design of web sites (such as this course webpage). A good practice to track the evolution of our codes is to use a version control system (VCS), such as Git, Subversion, or Mercurial. These systems are relatively easy to set up and use. In this class we will use Git to systematically store the state of the code throughout its development. See the section Git for more information on using Git.
A few advantages of VCS:
- VCS allows you to keep track of the development of your software. You can store all versions (or at least the differences between versions) of your file set along with other supplementary material, such as user supplied information about code and its changes. This is particularly useful whenever you need to go back in the history of the software, for instance, if you realize the changes you made are incorrect. You can also easily compare different versions to see, for example, where a bug was introduced.
- The use of VCS is one easy way to greatly improve the reproducibility in computational science. For example, suppose that you use your code to compute some results for a paper. A year later when you get the reviews back, you may need to reproduce your results and then make a few modifications. Most likely your code will have changed significantly in one year, but if it is under version control it will be trivial to redo the computations and make modifications.
- When you work on a project using more than one machine, e.g. a desktop at home and a laptop at school, VCS is a good way to keep your projects synched up between the two machines.
- Software tools for revision control are essential for the organization of multi-developer projects. Larger software projects with multiple developers are almost always under version control so that different developers can work simultaneously on different parts of the code. Note that for larger projects it is also important to have some kind of unit testing. Unit testing is a software development process in which the smallest testable parts of a project, called units, are individually and independently examined for proper operation.