← Git from Scratch
Lesson 16 of 17 · 5 XP
The workflow: branches and Pull Requests
Theory
Machine translation, not yet reviewed by a native speaker.
This is how almost every team works, including yours with Kai and Alex:
git switch main && git pull— start from the latest version;git switch -c feature/login— a branch for one task;- small commits with clear messages;
git push -u origin feature/login;- open a Pull Request (PR) on GitHub — a request to "merge my branch";
- review: colleagues read the code and leave comments, and automated tests (CI) check the build;
- merge into
main, delete the branch.
A good commit message:
Add in-browser checking of C tasks
clang in WebAssembly compiles the solution, and a mini-WASI runs it
on each test. Reference solutions are checked by gcc on the server.
- the first line — up to ~50 characters, what the commit does (imperative mood: "Add", "Fix", not "Added");
- an empty line;
- then, if needed, why, and the details.
Many teams use the Conventional Commits convention: feat: …, fix: …, docs: …, refactor: …. From these prefixes a list of changes can be put together automatically.
What not to do:
- commit secrets (passwords, keys,
.env); - huge "did everything" commits — nobody can review them;
git push --forceto shared branches;- work directly in
mainin a team.