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
| Word | What it means |
|---|---|
| Version control | A tool that records every change to your files, so you can go back to any earlier version. |
| Source control | Version control for source code, plus sharing it and managing who changes what. |
| Repository | A store for a project and its full history. |
| Commit | A saved step in the history, with a message. |
| Clone | Make your own copy of a repository. |
| Stage | Choose which changes go into the next commit. The command is git add. |
| Push | Send your commits to the shared repository. |
| Pull | Bring other people's commits into your copy. |
| Merge conflict | Two people changed the same line. Git cannot choose, so you must. |
| Pull request | A 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 questionsYour 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
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
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
git clone http://student:student@gitea:3000/student/hello-git.git ~/aliceA command for the lesson’s lab terminal. It is shown here and not run.
4. Bob gets a copy
git clone http://student:student@gitea:3000/student/hello-git.git ~/bobA command for the lesson’s lab terminal. It is shown here and not run.