Programming
Lab 8 · Git & GitHub Lab: Branch, Commit, Pull Request Workflow
🎯 Objective
Practise the exact collaboration workflow used by real software teams — not just git add and push to main.
🧩 Skills You Will Practice
- Branching and merging
- Commit message discipline
- Pull requests and code review
- README documentation
🧰 What You Need
- Git installed
- Free GitHub account
- A practice repository (use your Lab 7 to-do app)
- Terminal or VS Code integrated terminal
📋 Step-by-Step Tasks
- Initialise or clone your practice repo, confirm git status is clean on main, and add a README describing the project, features and how to run it. Commit: docs: add README.
- Create a feature branch: git checkout -b feature/task-counter. Never do feature work directly on main in this lab.
- Make one focused change on the branch (for example the tasks-remaining counter). Run git diff and read every line before staging it — professionals review their own diff first.
- Commit in the conventional style: feat: add remaining tasks counter. Push the branch with git push -u origin feature/task-counter.
- Open a Pull Request on GitHub: write a title, a What changed / How to test description, and link the PR to the lab. Read the Files changed tab as a reviewer would.
- Add one review-style comment to your own PR noting a risk or improvement, then merge the PR, delete the branch on GitHub, and pull the updated main locally.
- Repeat once more with a second small branch for a bug fix (fix:) so your history shows both a feature and a fix merged through PRs.
✅ Expected Result / Deliverable
A GitHub repository whose history shows main protected by workflow: 2 feature branches, conventional commits, 2 merged PRs with descriptions — link-ready for a portfolio.
⚠️ Common Mistakes
- Committing everything in one giant update commit
- Writing PR descriptions like changes or fixed stuff
- Merging without reading Files changed
- Committing passwords or keys — treat anything pushed as public forever
Safety, Ethics & Pro Tip
Use a practice repository only. If you ever push a secret by accident, rotate that password/key immediately — deleting the commit does not un-publish it.