Easier to read with cream paper, a tint, more contrast or larger text? Choose your colours and text, once, for every page.

Preview

Version control, conflicts and reviews

This is the first page of the lesson. Read it and have a go at the activities. The rest is in the full lesson.

60 minutes

final_FINAL_v3_really.docx

Have you ever saved a file as "essay_final", then "essay_final2", then "essay_final_really"?

Now imagine five people do this to the same program. Nobody knows which copy is the real one.

Teams solve this with version control. Version control means a tool that records every change to your files. Today you use it with a partner. You will also make a mistake on purpose, and fix it.

Key words

WordWhat it means
Version controlA tool that records every change to your files, so you can go back to any earlier version.
Source controlVersion control for source code, plus sharing it and managing who changes what.
RepositoryA store for a project and its full history.
CommitA saved step in the history, with a message.
CloneMake your own copy of a repository.
StageChoose which changes go into the next commit. The command is git add.
PushSend your commits to the shared repository.
PullBring other people's commits into your copy.
Merge conflictTwo people changed the same line. Git cannot choose, so you must.
Pull requestA request to merge your branch, so the team can review it first.

The cells students fill in are left blank in this preview.

Version control or source control?

The two words are close. Version control records the history of any files and lets you go back.

Source control is about source code in a team. It adds sharing, branches, reviews and rules about who may change what.

Git is the tool. A server such as Gitea, GitHub or GitLab holds the shared copy.

Quick check

Have a go

Quick check

3 questions
Have a go: your answers are marked here and then forgotten. Sign in if you would like your score kept, and to pick up where you left off.Sign in to keep your score

Your answers are marked here and are not kept. A college account keeps every student’s marks.

The plan for the lab

Press Start the lab and wait until it is running. The terminal has Git. The server is Gitea, at http://gitea:3000. Sign in at the Gitea tab as student with the password student.

You will play two people, Alice and Bob. Each gets a folder. Both change the same file. That makes the conflict.

1. Your name for Git

Command
git config --global user.name "Student"

A command for the lesson’s lab terminal. It is shown here and not run.

2. Your email for Git

Command
git config --global user.email "[email protected]"

A command for the lesson’s lab terminal. It is shown here and not run.

3. Alice gets a copy

Command
git clone http://student:student@gitea:3000/student/hello-git.git ~/alice

A command for the lesson’s lab terminal. It is shown here and not run.

4. Bob gets a copy

Command
git clone http://student:student@gitea:3000/student/hello-git.git ~/bob

A command for the lesson’s lab terminal. It is shown here and not run.

The lesson goes on

21 more parts of this lesson are in the full curriculum, with the tasks, the final check and the labs. A college account gives your students all of it.