Another person reads it first
You fix a bug and merge it. Later the site breaks. You did not see the mistake in your own change.
Teams use review to solve this. Before a change joins the shared code, somebody else reads it. A pull request is the tool for this. It asks to join your work into the main code, and others can read it first.
Key words
| Word | What it means | Example |
|---|---|---|
| Pull request | A request to join your branch into main, which others can read and discuss. | Add contributing rules |
| Review | Another person reads your change and says if it is good. | Please fix the typo |
| Push | Send your commits to the server. | git push |
| Pull | Bring new commits from the server to your computer. | git pull |
| Commit message | A short note that says what a commit changes and why. | Fix login for names with spaces |
| Branch | A separate line of work. | add-contributing |
| Server | A computer that holds the shared copy of the project. | Gitea |
| Repository | A folder of files with all its history. | hello-git |
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. Press Gitea on the same bar to open it in a second tab. Keep that tab open: you use it in step 3.
1. A fresh copy
Tell Git your name and email. Then clone the project (make your own copy) into a folder called review. Then go into the folder.
git config --global user.name "Student"A command for the lesson’s lab terminal. It is shown here and not run.
git config --global user.email "[email protected]"A command for the lesson’s lab terminal. It is shown here and not run.
git clone http://student:student@gitea:3000/student/hello-git.git reviewA command for the lesson’s lab terminal. It is shown here and not run.
cd reviewA command for the lesson’s lab terminal. It is shown here and not run.
2. Make a change on a branch
Add a file with a rule for the team. Then push (send) the branch to the server. The branch is now on the server. Main is not changed.
git switch -c add-contributingA command for the lesson’s lab terminal. It is shown here and not run.
echo "Write a clear commit message for every change." > CONTRIBUTING.mdA command for the lesson’s lab terminal. It is shown here and not run.
git add CONTRIBUTING.mdA command for the lesson’s lab terminal. It is shown here and not run.