Nishaglobal Education logo

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.

Final projectAbout 3 hoursQuiz: 4 questions

🎯 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
  1. The brief
  2. The three parts
  3. Part 1: set up and publish
  4. Part 2: deliver a feature through a pull request
  5. Part 3: handle a teammate's change
  6. Check your work
  7. Recap
  8. Quiz
  9. Self-check and complete

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

PartYou willSkills (lesson)
1. Set up and publishAdd a .gitignore, make the first commit, push to a new GitHub repository, turn on GitHub Pages, add a README2, 5, 8, 11
2. Deliver a featureCreate a branch, commit a projects section, push, open a pull request, respond to review6, 10
3. Handle a teammate's changePull a teammate's commit, resolve the merge conflict on your branch, push, merge the PR, tidy up and tag v1.07, 9, 10, 11

Part 1: set up and publish

  1. In your project folder, run git init.
  2. Create a .gitignore that ignores .env and *.log (and anything else private or generated).
  3. Check git status --short: secrets and logs must not be listed. Then git add . and commit.
  4. Create an empty repository on GitHub, connect it with git remote add origin … and git push -u origin main.
  5. Turn on Settings → Pages (main branch, root folder) and open your live site.
  6. Add a README.md with 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.

  1. git init, then create .gitignore.
  2. git status --short to check.
  3. git add . and commit; add the remote and push.
Show the solution
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 main

Output

?? .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

  1. Start from the latest main: git switch main and git pull.
  2. Create a branch: git switch -c projects-section.
  3. Add a projects section to your page, commit with a clear message, and push the branch with -u.
  4. On GitHub, open a pull request into main with a helpful description.
  5. 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.

  1. git switch main and git pull to get Ravi's commit.
  2. git switch projects-section and git merge main. Git reports a conflict in index.html.
  3. Edit the file to keep both good changes (your new footer wording and Ravi's), remove the markers, then git add and git commit.
  4. git push. The pull request now says it can be merged. Merge it on GitHub and delete the branch.
  5. Locally: git switch main, git pull, git branch -d projects-section.
  6. Tag the result: git tag -a v1.0 -m "First public version" and git 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
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 -5

Output

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

CheckHow
No secrets or junk in the repositoryBrowse the files on GitHub; .env and logs must not be there
Clear historygit log --oneline reads like a list of meaningful changes
Live site worksOpen your GitHub Pages address on your phone
Pull request tells a storyTitle, description, at least two commits and a resolved conflict
Tidy local repositorygit branch shows only main; git status is clean and up to date
Release taggedThe 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. 1. Why create the .gitignore before the first git add .?

  2. 2. Your pull request has conflicts with main. Where is the best place to resolve them?

  3. 3. After your PR is merged on GitHub, what should you do locally?

  4. 4. How should a teammate set a different name only for one repository?

Answer all 4 questions to check.

Self-check and complete the course

Self-check rubric

Tick each item only when your own project meets it.

Tick every rubric item to complete the project.