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.
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
- No secrets. Last night's commit put a password file in the repository. No commit on
main, and nothing on the shared server, may containadmin-notes.txt. (Look before you build on top of it.) - 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. - Priya's dark mode is in. Her
dark-modebranch is merged intomain. It conflicts: sort it out, and leave no conflict markers behind. - A private to-do list. Keep your own
todo.txtin~/site, but it must never end up in Git, not in any commit. - Shared. A bare repository at
/srv/git/site.githas your finishedmain. - Teammate ready. A clone of it in
~/site-copyis up to date with the sharedmain. - Release. The finished
mainhas an annotated tagv1.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.
Was this challenge helpful?