EP1000

Version Control

Version control is the management of changes to documents, software, web sites and other collections of information. In usual practise, the change of such documentation is done by labelling the filename or document with a number or letter code e.g. v1.01, v4a.

Reasons for version control

Assuming you are writing an essay/paper/code for an assignment that has to be submitted online, have you ever:

If you answered YES to any of the above questions, then you need a version control system.

git

Git is a free and open-source distributed version control system. It is very easy to learn and provides good support for all projects regardless of size. It is also available for different Operating Systems (OS).

git usually works from the CLI (command-line interface), however there are GUI (Graphic User Interfaces) available, which are easier for the beginner.

A summary of the git commands are given in the table, it provides a reference of what we usually use.

Before we use git, we usually need to identify ourselves to git and to the repository

git config --global user.name "John Doe"
git config --global user.emal "jdoe1234@example.com"

You would usually log-in or provide your credentials to the remote repository so that you can access your account.

git command Purpose
Initialise Usually done only once to start the repository
git clone Clones/Copies and downloads a repository to your folder.
It is a fast way of making a copy of an existing work. There are
Two methods of cloning: SSH and HTTPS. We shall use HTTPS
git init Initialises a local folder for git
git pull Brings down a current version of the repository.
Works only when the repository already exists.
Should always be the first command, before you start any work.
Repeated  
git add * Add any files to the staging area.
This will pick up any files which have been updated/added/removeid.
git status Shows the files in staging area
git commit -m
“info on what is done”
Moves the files from the staging area to the local repo
git push Copies the files from the local pc to the remote repo

There are other commands, however, we will leave them for now until you are fully acquinted with the git process. The following diagram illustrates what usually happens:

Common git commands

 

Git process

This is a brief outline of the git process done by the Github Desktop (GHD). git uses (traditionally) commands entered on the CLI (command-line interface). Github Desktop specifially uses a GUI to convert actions to this commands.

Tutorials for git

There are many tutorials for git (shows you how important git is) and we recommend that you watch at least one Youtube video and walk through one git tutorial.

Youtube videos on git

Git Online Tutorials

References

 

git for Windows 10

As most of you are working with Microsoft Windows 10, there are a number of versions of git that you can use:

Github Desktop

I’ve already written a guide here for staring a repo using Mr Steven Chew’s web-pk, you can follow the guide here.

Quick links:

 

Assignment

The assignment for this class is Assignment 5 Version Control. You will be required to

  1. Familiarize yourself with version control software - git.
  2. Create a version-controlled site on github for this module.
  3. Record your website URL for marking/discussion.

This assignment is only due on Week 5 of this term.

 

Home Home
October 2020