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.
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 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:
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.
As most of you are working with Microsoft Windows 10, there are a number of versions of git that you can use:
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:
In this assignment, you will install git. If you are working on a Microsoft Windows 10 system, then I would strongly install Github Desktop, as we are more interested in the process of version control. You will then put your blog into a “version control” system using git.
I have provided approximate timings for you so that you do NOT spend all your time (doing something you like and neglecting other modules!)
Time | Task |
---|---|
10 min | Install git/Github Desktop |
20 min | Watch one Youtube video on “git for beginners” |
20 min | Work through one online tutorial on git |
40 min | Convert your blog site to use git Write-up the process of converting and implementing a version control system on your blog |
40 min | Demonstrate how you would recover an error using git Use your blog as the example, and show how you would recover a deleted paragraph. document it in your blog. |
Here is a quick guide on how to do the last part:
One LUCKY person will present his/her work to the class as the next session.
May 2020