1 of 14

Version Control with Git

A brief Introduction

John Robinson

2 of 14

What is Version Control?

Also known as:

  • Revision control

  • Source control

3 of 14

What is Version Control?

Software tools to help you manage your project:

  • Tracks changes to files
    • At points decided by you
    • With attribution
  • Any file can be tracked
    • Text ( csv, .py, .c, .r etc.) works best

4 of 14

Why use Version Control?

  1. A more efficient use of storage

  • Reproducibility

5 of 14

Why use Version Control?

3. Collaboration

6 of 14

How does VC work?

Version Control tracks changes to files:

  • Changes are tracked sequentially

7 of 14

How does VC work?

  • Different versions can be saved

8 of 14

How does VC work?

  • Multiple versions can be merged

9 of 14

Version Control Options

  • Subversion (svn) - Centralised
  • Mercurial (hg) - Distributed

  • Git (git) – Distributed
    • Most widely used in academia
    • N.B. GitHub != git
      • Git is the tool, GitHub is Co. + website. There are alternatives.

10 of 14

Graphical Version Control

  • SourceTree

  • Git Kraken

  • Git GUI

11 of 14

Git commands (via Bash)

  • $ git config
    • Set global info
  • $ git init
    • Create a repository
  • $ git status
    • Show status

12 of 14

Git commands (via Bash)

  • $ git add
    • Track files
  • $ git commit
    • Log changes
  • $ git log
    • Show history

13 of 14

Optional further reading

14 of 14

Optional further reading

  • Before you start, you’ll need the resources for that workshop, which are fetched (ironically, via git) in the Bash shell:

  • $ git clone https://github.com/Southampton-RSG/2019-03-13-southampton-swc.git