2021-11-29
Version control in software development consists in recording all changes in the source code with the help of a version control system (VCS), a collection of software tools which manage versioning and collaboration in software development.
Version control allows to track all changes in a software system, to manage different development branches, to organize the collaboration of developers. In the case of research software, version control is becoming an indispensible tool to maintain Good Scientific Practice.
Centralized version control systems like subversion (svn) work based on the client-server priciple. Developers check out working copies from a central server, and commit the changes back to that server after work has been finished.
Distributed version control systems like git and mercurial are organized after the peer-to-peer principle. Instead of a working copy containing only a current version, users maintain clones of repositories, each of them containing the full history of the code. While it is possible to emulate the centralized model with this approach, the additional flexibility of this model has many advantages.
Git was intiated by Linus Torvalds and as of now (2021) became the de-facto standard for source code management systems.
Its origin as a tool for hardcore coders brings along a command line interface which is not easy to learn. Here are some resources besides the git homepagee with a number of external resources:
It is often stated that understanding git is significantly eased by understanding the way it organizes data. Here the basic idea is that all the different stages developed sequentially or in parallel of a program source can be organized as a Directed Acyclic Graph (DAG). This is what git does, and Git for Computer Scientists draws on this idea.
git - the simple guide "just a simple guide for getting started with git. no deep shit ;)"
Backlog Git Tutorial "If you are completely new to Git, you can start exploring the "Getting Started" section for an introduction"
Software Carpentry "Version Control with Git"
For collaborative development, it is worth to dig down the concept of branches.
In order to avoid or to minimize the interaction with git via the command line, graphical user interface tools are available. A good quality criterion for choosing such a tool is its ability to visualize the underlying DAG.
Windows, Mac: sourcetree
On Linux, there are a number of tools. Among them are:
It should be possible to install them wia the package manager of your distribution.
Also, now there is gitui for work in the terminal.
Modern editors and editing environments like Visual Studio Code have a git extension supporting basic workflow.
At the current stage, the decentralized model of development is to a significant extent thwarted by the availability of platforms like github and gitlab which in addition to hosting provide important additional features like Continous Integration (server based automatic software tests), issue discussions, easy support for standard workflows, wiki pages and more.
These platforms introduced the useful concept of pull requests aka merge requests.