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

Preview

Build, save versions and review code

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

45 minutes

Two people, one file

Sam and Aisha both change the same file. Sam saves at 10:00. Aisha saves at 10:05. Sam's work is gone.

Teams solve this with version control. Version control is a tool that keeps every version and joins changes safely. Even when you work alone, it protects you.

Key words

WordWhat it meansExample
Version controlA tool that keeps every saved version of your work.Git
RepositoryA folder that holds your project and its history.hillside-tool
CommitA saved step in the history, with a short message.Add leave_waiting_list
BranchA separate line of work. You can join it back to the main work later.waiting-list
Pull requestA request to join your branch into the main one, so others can review it.Add the waiting list
Code reviewAnother person reads your code and gives feedback.a checklist
Pair programmingTwo people work at one computer. One types and one watches.one person types, one person checks
MergeJoin the work of a branch into the main version.join waiting-list into main
FunctionA named piece of code that does one job.next_in_line()
ReadabilityHow easy the code is for a person to read.clear names

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

The Git commands in this lesson

CommandWhat it does
cd hillside-toolGoes into the folder
echo "text" > waiting.pyMakes a file called waiting.py with that text in it
git init hillside-toolMakes a new repository in a folder called hillside-tool
git statusShows which files changed
git add waiting.pyChooses a file for the next commit
git commit -m "message"Saves a step with a short message
git log --onelineShows the history, one line each
git checkout -b waiting-listMakes a new branch and moves to it

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

Start the lab first

data-callouts.note.label

Press Start the lab on the bar at the top of this lesson. Wait until it says it is running. Each Run button types a command into your lab terminal. Every command makes a new practice folder, so nothing important can break. Never run a command you do not understand.

Step 1: make a repository

Command
git init hillside-tool

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

Step 2: go into the folder

Command
cd hillside-tool

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

Step 3: make a file

Command
echo "# Hillside waiting list" > waiting.py

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

Step 4: ask Git what it sees

Command
git status

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

What did you see?

Have a go

What did you see?

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 lesson goes on

16 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.