Git Tutorial: Version Controlling Your Source Code

Git Tutorial: Version Controlling Your Source Code

Last week saw one of many seminars for the third NGCM cohort as a part of the Professional Skills Development module – what better a topic than an introduction to Git from Dr Ian Hawke.

Git is a version control system used worldwide, by amateur and professional software developers alike. There has long been a war raging between different version control systems but git has slowly become triumphant, thanks in part to the free cloud storage offered through GitHub. The seminar begun by the cohort creating an account on the site, an account that will no doubt see a lot of use over the coming years.

The seminar then went on to really focus on the basics of using Git, with an emphasis on how the tool can be used to create backups of source code at discrete time steps, thereby allowing users to ensure that they can trace back in time the development of source code and determine where bugs have been introduced. Another key feature introduced was the concept of branching and merging, whereby a branch (a copy of the current source code) can be made such that experimental code changes can be made in this branch without worrying about it causing problems in the main development branch. Once a user is happy with the changes they can then be merged back into the main branch, in contrast if the experiment bears no fruit then the new branch can simply be left for future reference without ever impacting the main project development.

The final area covered was possibly one of the most useful features of Git, and that is the ability to allow for multiple users to contribute to the same source code repository– allowing for large scale collaborations on a single project, and offering visibility to all users as to what, where and by whom changes are being made.

Written by Pete Bartram