Public beta. We're in our soft launch: the lessons are ready, but things may still change, and your feedback shapes what comes next.

Git · Final challenge

Final challenge: release day

The Coding Club's website lives in ~/site. The club has moved its meetings to Wednesday, Priya's dark mode is still waiting on its branch, and today everyone needs the finished site on the shared server, tagged as version 1.0. Oh, and you committed something late last night that you probably shouldn't have.

How this works

No step-by-step instructions: the objectives say what must be true when you're done, and the checks look inside the repository itself. git status and git log --oneline --graph --all are your friends. The cheat sheet and search (/) are allowed, and hints are below the terminal.

The brief

  1. No secrets. Last night's commit put a password file in the repository. No commit on main, and nothing on the shared server, may contain admin-notes.txt. (Look before you build on top of it.)
  2. Fix it on a branch. The home page should say We meet on Wednesdays. Make that change on a new branch of your own, commit it there, and merge it into main.
  3. Priya's dark mode is in. Her dark-mode branch is merged into main. It conflicts: sort it out, and leave no conflict markers behind.
  4. A private to-do list. Keep your own todo.txt in ~/site, but it must never end up in Git, not in any commit.
  5. Shared. A bare repository at /srv/git/site.git has your finished main.
  6. Teammate ready. A clone of it in ~/site-copy is up to date with the shared main.
  7. Release. The finished main has an annotated tag v1.0, and the shared repository has it too.

Stuck? Hints

Open only as many as you need.

0. No secrets

Start with git log --oneline and git status. The newest commit, “Add admin notes”, hasn't been pushed anywhere yet, so you can simply take it back: git reset --hard HEAD~1 (or git reset HEAD~1 and delete the file). git revert wouldn't do: the password would still be in the history.

Still stuck: lesson 2.

1. Fix it on a branch

git switch -c NAME makes a branch and moves to it. Change the line (sed -i or an editor), git commit -am "…", then go back to main and git merge NAME.

Still stuck: lesson 3.

2. Dark mode

git merge dark-mode stops with a conflict in style.css. Either edit the file and delete the <<<<<<<, ======= and >>>>>>> lines, or take one side with git checkout --theirs style.css. Then git add and git commit.

3. A private to-do list

Put the name in .gitignore before you add anything, and commit the .gitignore. git status should no longer mention todo.txt. Careful with git add .!

Still stuck: lesson 1.

4. Shared

Make /srv/git yours with sudo, create an empty bare repository with git init --bare, add it as origin and push main. Push again after later commits.

5. Teammate ready

git clone /srv/git/site.git ~/site-copy. If you push more later, git pull inside the copy brings it up to date.

6. Release

git tag -a v1.0 -m "…" on main (annotated: with -a and a message), then git push origin v1.0, because a plain push doesn't send tags. Still stuck: lesson 6.

Complete every objective in the terminal and the challenge is marked done automatically. It's optional, but it goes on your certificate.

Send feedback

We're in a public beta, so every message helps. What's on your mind?

Please don't include your name, email or other personal details. We can't reply, but we read every one. We'll note which page you sent it from.