Save it with git, open a pull request
By the end of this step your checker is on GitHub, and you've proposed a change to it the way developers do: on a branch, through a pull request.
Four words you need
Do this whole step in VS Code's terminal, in your description-checker folder (you should see checker.py or checker.mjs when you run ls).
1. Write a README
A README is the front page of a repo: what it is and how to use it. In VS Code, create a file called README.md and write something like this, in your own words:
# Description checker
Lists Ridgeline's shortest product descriptions, with word counts
and reading times, so marketing knows which ones to rewrite.
## How to run it
python checker.py
Needs descriptions.csv in the same folder.(.md means Markdown: plain text where # makes a heading. GitHub shows it nicely formatted.) Save it.
2. Make it a repo and save the first version
git init -b mainThis makes the folder a repository, with main as its first branch.
git add .git add picks which changes go into the next save. The . means "everything in this folder".
git commit -m "First version of the description checker"-m is the message. Write what changed, in plain words.
3. Put it on GitHub
gh repo create description-checker --public --source . --pushThis creates the repo on GitHub, connects your folder to it, and uploads ("pushes") your commit, in one go.
4. Make a branch for a change
Marketing asks for a tweak: "Can it list every description under a certain number of words, not just the shortest ten?" You'll add a --min-words option, so running python checker.py --min-words 20 lists every description under 20 words.
Make a branch for it:
git switch -c min-words-c creates a new branch called min-words and switches to it. Your changes now happen here, not on main.
5. Add the option
When you run python checker.py --min-words 20, the words after the program's name are handed to your program as a list:
- Python:
sys.argv(afterimport sys) is["checker.py", "--min-words", "20"] - JavaScript:
process.argvis["node", "checker.mjs", "--min-words", "20"](with full paths)
Change your program so that if --min-words is in that list, it prints every description with fewer words than the number after it, then how many that was. Without the option, it does what it did before.
Your turn
Write the --min-words option. Test it both ways: with --min-words 20 (you should get 66 descriptions under 20 words, counting the empty ones), and with no option at all (the same output as before).
6. Save the change and open a pull request
When both tests work:
git add .git commit -m "Add --min-words option"git push -u origin min-wordspush uploads your branch to GitHub. -u origin min-words tells git where it lives, once; next time git push alone is enough.
gh pr create --fill--fill uses your commit message as the pull request's title.
Here there's no one else to review it, so review it yourself: read every changed line. Happy? Click Merge pull request, then Confirm merge. Your change is now in main.
Back in the terminal, bring your computer's main up to date:
git switch maingit pullIf it didn’t work
"Author identity unknown". git doesn't know your name yet. Run the two git config commands from Get set up, step 4.
"gh: command not found" or "not logged in". Do Get set up, step 4, then run gh auth status to check.
"a repository with this name already exists". You made one before. Use another name: gh repo create description-checker-2 --public --source . --push.
git push asks for a username and password. Run gh auth setup-git, then push again. That tells git to sign in through gh.
Hand in
- The link to your repo on GitHub
- One paragraph: what would you change if this had to run every night, automatically, with no one pressing Run?
Stamp the self-check on the right, tick I've submitted, and the answer key opens below.