Final project: publish your portfolio and run a team workflow on GitHub
Bring the Git course together: put a project under version control with a .gitignore, publish it on GitHub and GitHub Pages, deliver a feature through a pull request, and resolve a real merge conflict.
🎯 By the end of this project you will be able to:
- Put a real project under Git with clean history and no secrets
- Publish it on GitHub and GitHub Pages
- Deliver a change through a branch and pull request, including a merge conflict
Outline
The brief
You will use Git exactly as a junior developer does in their first job: set up a repository properly, share it, and deliver changes through pull requests while a teammate is changing the same project. At the end you will have a public repository and a live website to put on your CV.
Use your portfolio from the HTML & CSS course, or any small website. If you have no project yet, create an index.html and styles.css with a few lines each.
The three parts
| Part | You will | Skills (lesson) |
|---|---|---|
| 1. Set up and publish | Add a .gitignore, make the first commit, push to a new GitHub repository, turn on GitHub Pages, add a README | 2, 5, 8, 11 |
| 2. Deliver a feature | Create a branch, commit a projects section, push, open a pull request, respond to review | 6, 10 |
| 3. Handle a teammate's change | Pull a teammate's commit, resolve the merge conflict on your branch, push, merge the PR, tidy up and tag v1.0 | 7, 9, 10, 11 |
Part 1: set up and publish
- In your project folder, run
git init. - Create a
.gitignorethat ignores.envand*.log(and anything else private or generated). - Check
git status --short: secrets and logs must not be listed. Thengit add .and commit. - Create an empty repository on GitHub, connect it with
git remote add origin …andgit push -u origin main. - Turn on Settings → Pages (main branch, root folder) and open your live site.
- Add a
README.mdwith a title, description, how to run it and a link to the live site. Commit and push.
Guided exercise
Part 1 worked solution
Set up the repository, check nothing private is included, commit and push.
git init, then create.gitignore.git status --shortto check.git add .and commit; add the remote and push.
Show the solution
git init -q
printf '.env\n*.log\n' > .gitignore
git status --short
git add .
git commit -m "Add portfolio page and stylesheet"
git remote add origin https://github.com/asha-kumar/my-website.git
git push -u origin mainOutput
?? .gitignore ?? index.html ?? styles.css [main (root-commit) 02ab11e] Add portfolio page and stylesheet 3 files changed, 6 insertions(+) create mode 100644 .gitignore create mode 100644 index.html create mode 100644 styles.css To https://github.com/asha-kumar/my-website.git * [new branch] main -> main branch 'main' set up to track 'origin/main'.
How to get there: Because the .gitignore exists before the first git add ., the status lists only .gitignore, index.html and styles.css: .env and debug.log never enter the history. Then the usual remote add and first push with -u.
Part 2: deliver a feature through a pull request
- Start from the latest main:
git switch mainandgit pull. - Create a branch:
git switch -c projects-section. - Add a projects section to your page, commit with a clear message, and push the branch with
-u. - On GitHub, open a pull request into main with a helpful description.
- Review your own pull request on the Files changed tab (or ask a friend). Make at least one improvement as a second commit and push it, and watch the pull request update.
Part 3: handle a teammate's change
Meanwhile, Ravi changed the same footer line on main. Your pull request now shows *This branch has conflicts that must be resolved*. Fix it on your branch: bring main's new commit in, resolve, and push.
git switch mainandgit pullto get Ravi's commit.git switch projects-sectionandgit merge main. Git reports a conflict in index.html.- Edit the file to keep both good changes (your new footer wording and Ravi's), remove the markers, then
git addandgit commit. git push. The pull request now says it can be merged. Merge it on GitHub and delete the branch.- Locally:
git switch main,git pull,git branch -d projects-section. - Tag the result:
git tag -a v1.0 -m "First public version"andgit push origin v1.0.
Your turn
Parts 2 and 3 worked solution
Asha's branch changes the footer and adds a projects section; Ravi has already pushed his footer change to main. Bring main into the branch, resolve the conflict keeping both changes, push the branch, and show the history.
Show the solution
git switch main
git pull
git switch projects-section
git merge main
printf '<h1>Asha Kumar</h1>\n<p>Junior web developer</p>\n<h2>Projects</h2>\n<p>Green Leaf Café website</p>\n<footer>Made with care in Pune, India</footer>\n' > index.html
cat index.html
git add index.html
git commit -m "Merge main into projects-section, keep both footer changes"
git push
git log --oneline --graph -5Output
Switched to branch 'main' Your branch is up to date with 'origin/main'. From https://github.com/asha-kumar/my-website 02ab11e..eba5fcc main -> origin/main Updating 02ab11e..eba5fcc Fast-forward index.html | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) Switched to branch 'projects-section' Your branch is up to date with 'origin/projects-section'. Auto-merging index.html CONFLICT (content): Merge conflict in index.html Automatic merge failed; fix conflicts and then commit the result. <h1>Asha Kumar</h1> <p>Junior web developer</p> <h2>Projects</h2> <p>Green Leaf Café website</p> <footer>Made with care in Pune, India</footer> [projects-section 40f5027] Merge main into projects-section, keep both footer changes To https://github.com/asha-kumar/my-website.git 397ca52..40f5027 projects-section -> projects-section * 40f5027 (HEAD -> projects-section, origin/projects-section) Merge main into projects-section, keep both footer changes |\ | * eba5fcc (origin/main, origin/HEAD, main) Add country to footer * | 397ca52 Add projects section and new footer wording |/ * 02ab11e Add portfolio page and stylesheet
How to get there: Pulling main first brings Ravi's commit into your local main; merging main into your branch then shows the conflict on your computer, where you can test the result. The resolved footer keeps both ideas (*with care* and *India*). Pushing updates the pull request, which GitHub can now merge cleanly. (The printf line writes the resolved file for this transcript; you would edit the file in VS Code, keeping the projects section and the new footer.)
Check your work
| Check | How |
|---|---|
| No secrets or junk in the repository | Browse the files on GitHub; .env and logs must not be there |
| Clear history | git log --oneline reads like a list of meaningful changes |
| Live site works | Open your GitHub Pages address on your phone |
| Pull request tells a story | Title, description, at least two commits and a resolved conflict |
| Tidy local repository | git branch shows only main; git status is clean and up to date |
| Release tagged | The v1.0 tag appears under Releases → Tags on GitHub |
Recap
- You set up a repository properly: .gitignore first, then clean, focused commits.
- You published the code on GitHub and the site on GitHub Pages.
- You delivered a feature through a branch and pull request, responding to review.
- You resolved a real merge conflict with a teammate's change, merged, tidied up and tagged a release.
Check your understanding
Answer all 4 questions, then check your answers to see an explanation for each one.
1. Why create the .gitignore before the first git add .?
2. Your pull request has conflicts with main. Where is the best place to resolve them?
3. After your PR is merged on GitHub, what should you do locally?
4. How should a teammate set a different name only for one repository?
Self-check and complete the course
Tick every rubric item to complete the project.