What a code repository is

Tip: Choose Save as PDF in the print dialog to download. Use A4 paper size.

What a code repository is

Name:
Date:
Class:

Quick Questions

Shade in the A or B circle for each question.

1. Which best describes a code repository?
A A program that runs and tests your code automatically
B A storage location holding a project's files and full change history
2. A repository stored on your own computer is called...
A A local repository
B A remote repository
3. Which is an example of a remote repository?
A A project hosted on GitHub
B A project folder saved on your laptop's desktop
4. True or false: a repository only stores the latest version of the files.
A False: it stores the full change history
B True: older versions are thrown away
5. How does a remote repository help a team of developers?
A Each member must keep a private copy that nobody else can see
B Team members can all access and share the same code

Match the Pairs

Draw a line connecting each item on the left to its match on the right.

Left columnRight column
1git init ACopies a remote repository from GitHub onto your computer, including its full change history
2git clone https://github.com/team/app.git BA local repository is stored on your own computer. A repository hosted online, such as on GitHub, is a remote repository.
3A remote repository is hosted online so a whole team can share access to the same project CCreates a new local repository in the current folder so Git starts tracking the project's files and history
4A repository keeps the full change history, so every saved version of the code acts as a backup Dgit remote add origin https://github.com/team/app.git
5A local repository is stored on GitHub so teammates can all access it EA repository stores the full change history, not just the latest files, so earlier versions can be recovered.
6A repository only stores the latest copy of each file and no earlier versions Fgit log

Definitions

repository

Fill in the Blanks

Complete each line of code by filling in the missing parts.

1.
git ____
2.
git _____ https://github.com/team/app.git
3.
git ______ -v
4.
git ___ --oneline
5.
git ____ origin main

Spot the Error

Shade in the letter of the line that contains an error.

Question 1
A mkdir my_game
B cd my_games
C git init
D git status
Question 2
A git init
B git add main.py
C git commit -m "First save"
D git logs
Question 3
A git add notes.txt
B git commit "Add notes"
C git push
Question 4
A git new
B git add .
C git commit -m "Start"
Question 5
A git add .
B git commit -m "Add login"
C git pull origin main

Answer Key

What a code repository is
Section A: Quick Questions
Q1
B — A storage location holding a project's files and full change history
Q2
A — A local repository
Q3
A — A project hosted on GitHub
Q4
A — False: it stores the full change history
Q5
B — Team members can all access and share the same code
Section B: Match the Pairs
Q1
git init → Creates a new local repository in the current folder so Git starts tracking the project's files and history
Q2
git clone https://github.com/team/app.git → Copies a remote repository from GitHub onto your computer, including its full change history
Q3
A remote repository is hosted online so a whole team can share access to the same project → git remote add origin https://github.com/team/app.git
Q4
A repository keeps the full change history, so every saved version of the code acts as a backup → git log
Q5
A local repository is stored on GitHub so teammates can all access it → A local repository is stored on your own computer. A repository hosted online, such as on GitHub, is a remote repository.
Q6
A repository only stores the latest copy of each file and no earlier versions → A repository stores the full change history, not just the latest files, so earlier versions can be recovered.
Section C: Definitions
Q1
repository — A storage location for a project's files and full change history. It can be local or remote (e.g. GitHub), lets a team share code, and keeps a backup of every version.
Section D: Fill in the Blanks
Q1
git init
Q2
git clone https://github.com/team/app.git
Q3
git remote -v
Q4
git log --oneline
Q5
git push origin main
Section E: Spot the Error
Q1
B — The folder was created as my_game, so cd must use the same name: cd my_game. Then git init turns that folder into a local repository.
Q2
D — The command is git log, not git logs. It shows the full change history stored in the repository.
Q3
B — git commit needs the -m flag before the message: git commit -m "Add notes". The commit saves a snapshot into the repository history.
Q4
A — A new local repository is created with git init. git new is not a git command.
Q5
C — To back up commits to the remote repository (e.g. GitHub) you push them: git push origin main. git pull downloads changes instead.