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.

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. 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.
  2. 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.
  3. A private to-do list. Keep your own todo.txt in ~/site, but it must never end up in Git, not in any commit.
  4. Shared. A bare repository at /srv/git/site.git has your finished main.
  5. Teammate ready. A clone of it in ~/site-copy is up to date with the shared main.

Stuck? Hints

Open only as many as you need.

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

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.

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