Two issues are closed, and the third asks for a Christmas turkey pre-order page. This time, you didn’t start from an empty file. An AI assistant drafted the page in about the time it takes to find the cranberry sauce, and its files are ready to download:
Code you didn’t write deserves a careful read before it goes live, and reviewing AI-written code is everyday work in a developer’s job. In this lesson, you’ll put the draft on a branch, open its pull request, read what it changes, leave line comments, and then run the branch in a second copy of the project before you submit your review. Start by giving the draft a branch of its own.
Put the Draft on a Branch
The draft needs a pull request like every other change, and a pull request needs a branch. Extract the ZIP outside your project, such as in Downloads. On your laptop, check that you’re on main, which is up to date since your last merge, and that no uncommitted work is lying around, so the branch gets the draft and nothing else:
$ git status
On branch main
Your branch is up to date with 'origin/main'.
nothing to commit, working tree clean
If git status lists any changes, then commit or restore them first. With a clean tree, create the branch and copy the draft’s files over the project:
$ git switch -c turkey-preorder
Switched to a new branch 'turkey-preorder'
$ cp -R ~/Downloads/generic-grocery-turkey-draft/. .
The /. at the end of the source path copies everything inside the folder, including the hidden .env.example, which a file manager might leave behind.
The assistant also left one instruction with its draft: run npm install moment. A package from an AI assistant gets the same quick check as any new package before you install it. Open www.npmjs.com/package/moment, where the name is exactly moment, the Weekly Downloads run into the millions, and the Last publish date is recent. The terminal confirms the repository:
$ npm view moment repository.url
github:moment/moment
That’s moment’s official repository on GitHub, so the package is real. Whether the project needs it is a question for the review. For now, install it as the assistant said, so that the pull request shows exactly what a reviewer would meet:
$ npm install moment
added 1 package, and audited 99 packages in 896ms
27 packages are looking for funding
run `npm fund` for details
found 0 vulnerabilities
You usually read every staged diff before you commit. This time, commit the draft exactly as the assistant left it, so that the pull request shows what the assistant did and your review can respond to it. git add . stages every change in the project that Git doesn’t ignore, so stage everything and then read the list:
$ git add .
$ git status --short
M .env.example
M deals.html
M departments.html
M index.html
M package-lock.json
M package.json
M pickup.html
A src/data/turkey.js
A src/turkey-page.js
A turkey.html
M vite.config.js
The list includes the draft’s files plus package.json and package-lock.json from npm install, and your ignored .env isn’t on it. If another file shows up, then unstage it with git restore --staged and its path. Then commit and push:
$ git commit -m "Add an AI assistant's draft of the turkey pre-order page" \
-m "As the assistant wrote it, to review in its pull request."
[turkey-preorder 5ed30b4] Add an AI assistant's draft of the turkey ...
11 files changed, 84 insertions(+), 4 deletions(-)
create mode 100644 src/data/turkey.js
create mode 100644 src/turkey-page.js
create mode 100644 turkey.html
$ git push -u origin turkey-preorder
...
To https://github.com/generic-grocery-dev/generic-grocery.git
* [new branch] turkey-preorder -> turkey-preorder
branch 'turkey-preorder' set up to track 'origin/turkey-preorder'.
The commit and push output is shortened here, and your hash will differ. Open the pull request from the link in the push output. With a single commit on the branch, GitHub fills in the title and description from the commit message. Replace the title with the issue’s title, Add a Christmas turkey pre-order page, because npm run check finds this pull request by that title. Then replace the description with this one: