Welcome! This repository is a playground for practicing the everyday Git workflow. Instead of dry exercises, you'll learn the commands by playing a game of 21 Questions.
The plan is simple:
- Fork this repository to your own GitHub account.
- Clone your fork to your computer.
- Play the game by editing
21_questions.txtdirectly — the two players take turns writing into the same file. - Here's the key part: you add, commit, and push after every single question and every single answer, and you pull before each of your turns so you can see what the other player just wrote.
In other words, Git is how the two players talk to each other:
- The Guesser writes a question →
add→commit→push. - The Host does
pullto see the question, checks yes or no →add→commit→push. - The Guesser does
pullto see the answer, then writes the next question. - Repeat for all 21 questions, then the final guess and the reveal.
By the time you've finished a game, you'll have run the core Git loop — pull, edit, add, commit, push — dozens of times, which is exactly the rhythm of day-to-day software development.
21 Questions is a classic guessing game for two or more people.
The rules:
- One player is the Host. The Host secretly thinks of a person, place, thing, or animal and writes it down (don't show anyone yet!).
- The other player is the Guesser. The Guesser asks up to 21 questions to figure out what the Host is thinking of.
- Every question must be answerable with "Yes" or "No" (e.g. "Is it alive?", "Is it bigger than a car?"). The Host answers honestly.
- The Guesser can make a final guess at any time. If they guess correctly within 21 questions, the Guesser wins. If they run out of questions or guess wrong, the Host wins.
- Swap roles and play again!
Tip: Start with broad questions to narrow things down quickly ("Is it a living thing?") before asking specific ones ("Does it bark?").
Use the 21_questions.txt template to record your game.
These are the commands you'll use in this exercise. Run them from a terminal inside your cloned repository.
Forking happens on the GitHub website, not in the terminal. Click the "Fork" button in the top-right of this repo's GitHub page. This creates your own personal copy of the repository under your account that you can freely edit.
For a game, only one player needs to fork — that fork becomes the shared board both players push to.
📖 GitHub's guide: Fork a repository
Because both players push to the same repository, the fork's owner must invite the other player and give them write access.
- On your fork's GitHub page, go to Settings → Collaborators (you may be asked to confirm your password).
- Click "Add people", search for the other player's GitHub username, and select them.
- Choose the Write permission level — this lets them push commits but not change repository settings — and send the invitation.
- The other player accepts the emailed invite (or the link under their GitHub notifications). Now both of you can clone, push, and pull from this one repo.
📖 GitHub's guides: Inviting collaborators to a personal repository · Repository permission levels
Download your fork from GitHub to your local machine:
git clone https://github.com/<your-username>/github_practice_21_questions.git
cd github_practice_21_questionsBefore each turn, download whatever the other player just wrote so your local copy is up to date:
git pullAfter editing 21_questions.txt, stage your change so Git knows you want to
save it:
git add 21_questions.txtSave your staged change to your local history with a message describing what you just did:
git commit -m "asked q3"Upload your commit to GitHub so the other player can pull it:
git pushEvery question and every answer is its own pull → edit → add → commit → push cycle. Here's a full exchange for question 3.
Guesser's turn — ask a question:
git pull # get the latest file
# ...edit 21_questions.txt: write your question on line 3...
git add 21_questions.txt
git commit -m "asked q3"
git pushHost's turn — answer it:
git pull # see the new question
# ...edit 21_questions.txt: check [x] Yes or [x] No on line 3...
git add 21_questions.txt
git commit -m "A3: Yes"
git pushThen the Guesser pulls again and asks question 4. Repeat all the way to 21.
When the Guesser is ready (any time up to question 21), the game ends with two last commits.
Guesser's turn — make the final guess:
git pull
# ...edit 21_questions.txt: fill in the "My guess is:" line...
git add 21_questions.txt
git commit -m "Final guess: a toaster"
git pushHost's turn — score it and reveal the secret:
git pull
# ...edit 21_questions.txt: check Correct/Incorrect and fill in
# "THE SECRET WAS:" to reveal the answer...
git add 21_questions.txt
git commit -m "Reveal: it was a toaster — correct!"
git pushThe Guesser does one last git pull to see the reveal. Game over — swap roles
and play again!
This README and the accompanying template were written by Claude (an AI assistant by Anthropic). The exercise concept is Jon Chin's own idea, and Jon critically reviews all generated content.