Courses Learn Blog Contact
Get Started →
Lesson 10

Day 10: Git, GitHub and Project 2

Branches, pull requests, code review and merge conflicts, then the first group project: five people, one repository, a real problem and a rubric that reads the commit history.

Webbo3 Level 2: JavaScript Development 18 min read Free

Webbo3 Level 2 · JavaScript Development · Day 10 of 20

Git, GitHub and Project 2: Solve a Problem

Five people, one codebase, nobody overwriting anybody. The workflow every team you will ever join already uses.

By the end of today you can

  • Work on a branch and open a pull request
  • Review somebody else's code and have yours reviewed
  • Resolve a merge conflict without panicking
  • Split a problem into issues and assign them
  • Ship a real solution to a real problem as a team of five

Until today your repository has had one branch and one person. Today it gets four more people, and every habit that was merely untidy becomes genuinely expensive. Learn this properly now, on a small project, rather than in your first job on a big one.

1. Why branches exist

If five people all commit to main, everybody is editing the same live copy. Somebody pushes broken code and the project is broken for all five. Two people touch the same function and one silently loses their work.

A branch is your own copy of the project to work in. You break things in it freely, and when your piece is finished and works you ask for it to be merged.

TEXTbranching model
main                    always working, always deployable
 |
 +-- development        where finished features are combined and tested
      |
      +-- feature/search        Chidinma
      +-- feature/api-client    Musa
      +-- feature/filters       Amaka
      +-- fix/empty-state       Tunde

2. The commands you will use every day

BASHterminal
git status                       # what have I changed? run this constantly
git switch -c feature/search     # make a branch and move onto it
git add .                        # stage everything changed
git commit -m "Add debounced search to the student list"
git push -u origin feature/search   # first push of a new branch

# before you start each day, and before you open a pull request
git switch development
git pull                         # get everybody else's merged work
git switch feature/search
git merge development            # bring it into your branch

`git switch` rather than `git checkout`

checkout does two unrelated jobs, which is why it confuses beginners. switch changes branch and restore discards changes. Both have been in Git since 2019. You will still see checkout everywhere, so recognise it, but write the clear ones.

3. Commit messages that earn their place

You will read these when something breaks and you are trying to find the commit that caused it. "update" tells you nothing at 11pm.

Instead ofWrite
updateAdd empty state to the student list
fix bugFix page not resetting to 1 when the search changes
finalNormalise API response before rendering
asdfRemove unused sort helper
changesDebounce the search input at 300ms

The rule that gets you there: finish the sentence "If applied, this commit will...". Present tense, says what changed, and never mentions how long it took.

4. Pull requests

A pull request says: here is my branch, here is what it does, please look at it before it goes in. It is where code review happens, and code review is the single most effective way teams catch bugs before users do.

MARKDOWNpull request description
## What this does
Adds a debounced search box to the student list.

## Why
Filtering 200 students by scrolling was unusable on a phone.

## How to test it
1. Open the students page
2. Type "chi" slowly, then quickly
3. Confirm only one search runs, and the empty state shows for "zzzz"

## Notes
Search is local because the whole list is already fetched. If the list grows
past a few hundred, this should move to the API.

Reviewing somebody else's pull request

  • Pull the branch and run it. A review that only reads the diff misses anything that does not happen on screen.
  • Ask questions rather than issuing orders. "What happens here if items is empty?" lands very differently from "this is wrong".
  • Say what is good. A review that is only criticism makes people defensive and slower.
  • Check the things this course has taught: is user text going in with textContent, is response.ok checked, is there an empty state, can they explain it.

Never approve a pull request you did not read

Approving to be polite is how broken code reaches main with two names on it. If you have not understood it, say "I have not been able to review this properly yet". That is a completely acceptable thing to say, in this course and in a job.

5. Merge conflicts

A conflict happens when two branches changed the same lines. Git cannot know which one is right, so it stops and asks. It is not an error and you have not broken anything.

TEXTsrc/config.js
<<<<<<< HEAD
const PER_PAGE = 10;
=======
const PER_PAGE = 20;
>>>>>>> feature/filters
  1. Above ======= is what is already on your branch. Below it is what is coming in.
  2. Edit the file so it reads correctly: keep one, keep the other, or write a third thing that satisfies both.
  3. Delete all three marker lines. Leaving a <<<<<<< in the file is a syntax error, and it is the most common way a conflict resolution goes wrong.
  4. Then git add the file and git commit.

The habit that prevents most conflicts

Merge development into your branch every morning. Conflicts scale with how long branches drift apart: a branch merged daily has small, obvious conflicts, and a branch left alone for a week has terrifying ones.

6. Project 2: the brief

Project 2 · Groups of five · Rest of the week

Students at Webbo3 cannot find good learning resources in one place. They are scattered across YouTube, blogs, documentation and WhatsApp messages, and nobody knows which are any good. Build something that fixes that.

That is the whole brief, and it names a problem rather than a product. What you build is your team's decision and part of what is assessed. Two teams will reasonably build different things from this.

What it must include

  • Data from at least one real API, fetched and rendered.
  • Search and at least one filter or category.
  • All four states from yesterday: loading, error, empty, list.
  • Modules, not one file. At minimum an API layer, a render layer and the wiring.
  • Works at phone width.
  • A README explaining the problem, the solution and how to run it.

7. How the team works

RoleOwnsStill writes code
Product LeadThe decision about what you are building and what is out of scopeYes
API LeadFetching, normalising, error handlingYes
UI LeadLayout, states, responsivenessYes
QA LeadTesting every branch before it merges, keeping a bug listYes
Docs LeadREADME, the demo, the presentationYes

Everybody writes code. No exceptions.

A role is an extra responsibility, not a job instead of programming. The commit history is checked at assessment, and a team member with no commits fails the project regardless of what their team says about them.

The working rhythm

  1. Break the build into GitHub Issues, one per piece of work, each small enough for one person in half a day.
  2. Assign each issue to a person. One issue, one branch, one pull request.
  3. Nobody pushes to main or development directly. Ever.
  4. Every pull request needs one review from somebody else before it merges.
  5. Stand up for five minutes each morning: what I did, what I am doing, what is blocking me.

8. The marking rubric

CriterionMarksWhat is being judged
The problem15Did you understand it and scope it sensibly, or build the first thing you thought of
It works25Real API data, search, filter, all four states, on a phone
Code quality20Modules, naming, no dead code, no repeated blocks
Git and collaboration25Branches, real commit messages, pull requests, reviews with actual comments, every member committing
Presentation15Five minutes: the problem, the demo, what broke and what you did about it

The commit history is read, not skimmed

Twenty-five of the hundred marks are for how you worked together, and the repository is the evidence. Five commits all pushed by one person an hour before the deadline is a story the graph tells clearly, and it is marked as what it is.

Do this now

  1. Create the repository. Add a README and a .gitignore before anything else.
  2. Create development off main. Protect both if your plan allows it.
  3. Open at least eight issues and assign every one of them.
  4. Everybody creates their branch and pushes an empty commit today, so you find out today rather than on Thursday that somebody's Git access does not work.
  5. Agree three things in writing in the README: what you are building, what is explicitly out of scope, and who reviews whose pull requests.

Checkpoint

Q1. Why does nobody push straight to `main`?

Because main is meant to be working and deployable at all times. Anything pushed straight to it is unreviewed and untested, and when it breaks it breaks for the whole team at once.

Q2. You get a merge conflict. Have you broken something?

No. Two branches changed the same lines and Git is asking which one is right, because it cannot know. Edit the file, delete all three marker lines, add and commit.

Q3. What is wrong with approving a pull request you have not read?

It puts your name on code you have not checked and removes the only barrier between a bug and main. Saying you have not reviewed it yet is always the better answer.

Q4. Why merge `development` into your branch every morning?

Because conflicts grow with drift. Daily merges produce small obvious conflicts; a week of separation produces a merge nobody wants to do.

Tick before you move on

  • Repository, README and .gitignore exist before any code
  • development branch created, and nobody is pushing to main
  • Eight or more issues, all assigned
  • Every one of the five of us has pushed at least one commit today
  • Scope, out-of-scope and review pairs are written down in the README

Quick recap

A branch is your own copy; main stays working at all times · Commit messages finish "If applied, this commit will..." · A pull request is where review happens, and review is where bugs are caught · A conflict is a question, not a failure: resolve it and delete the markers · Everybody codes; twenty-five marks are for how the repository reads

Next week: state, storage, browser APIs, accessibility and debugging. The week that turns a student who can build into a junior developer.

Learn this with a real instructor

Free lessons take you a long way on your own. The full programmes add live classes, assignments, Skill Points and a certificate — built for African students.