Git & GitHub · Lesson 119 of 144
Project: A Projects Page
A feature branch and a pull request.
Now we add a page listing our projects. Following GitHub flow, we do it on its own branch, push it, and merge it through a pull request.

- A projects page
- On its own branch
- Merged through a pull request
The feature branch
Switch dash c, feature slash projects. We write the projects page, and commit it. Then we link to it from the home page, and commit again. Two small, focused commits. Finally we push the branch, ready for a pull request.
git
git switch -c feature/projects Switched to a new branch 'feature/projects' echo '<h1>My Projects</h1>' > projects.html git add projects.html git commit -m "Add projects page" [feature/projects 13a2e7a] Add projects page 1 file changed, 1 insertion(+) create mode 100644 projects.html echo '<a href="projects.html">Projects</a>' >> index.html git commit -am "Link to projects page" [feature/projects 71aa11e] Link to projects page 1 file changed, 1 insertion(+) git push -u origin feature/projects To https://github.com/sam/portfolio.git * [new branch] feature/projects -> feature/projects branch 'feature/projects' set up to track 'origin/feature/projects'.
After the merge
On GitHub, we opened the pull request, checked the diff, and merged it. Back home, we switch to main and pull, which brings in the merge. Then we delete the branch, and prune. The graph tells the whole story.
git
git switch main Switched to branch 'main' Your branch is up to date with 'origin/main'. git pull From https://github.com/sam/portfolio 32d71ae..b454a24 main -> origin/main Updating 32d71ae..b454a24 Fast-forward index.html | 1 + projects.html | 1 + 2 files changed, 2 insertions(+) create mode 100644 projects.html git branch -d feature/projects Deleted branch feature/projects (was 71aa11e). git fetch --prune From https://github.com/sam/portfolio - [deleted] (none) -> origin/feature/projects git log --oneline --graph -n 4 * b454a24 (HEAD -> main, origin/main) Merge pull request #1 from sam/feature/projects |\ | * 71aa11e Link to projects page | * 13a2e7a Add projects page |/ * 32d71ae Start portfolio
Summary
Branch, small commits, push, pull request, merge, then pull and tidy up. That's the daily rhythm of real projects. Next, releasing version one.
Key takeaways- feature/ branch
- PR, then merge
- pull, delete, prune
Next up: Project: Version 1.0 — tag and release