Public course previewThis is not your assigned passport. No identity, answers, or completion progress are stored here.How to start your passport
Handbook / labs

labs

Lab: First Safe Pull Request

Git records file versions on your computer. GitHub stores a shared copy. A pull request is GitHub's page for reviewing one branch before its changes are merged into the shared branch.

Goal: make one small manual change, review it, commit it, and open a draft pull request without changing main.

Prerequisites: your local Passport is open and the Configure Git Identity And GitHub Access mission passes. Do not clone another training repository for this lab.

New to text commands? Read how to open a terminal and run one command before using a command block. It explains the labels used below and what to copy.

Execution context: open a separate command terminal: Windows PowerShell, macOS Terminal (zsh), or Linux Terminal (Bash). Leave the terminal running the Passport open; it is serving the browser page.

The Complete A Manual Pull Request Loop mission is the primary procedure. Its Prepare practice folder button creates or reopens a separate practice clone and displays the exact folder, branch, push command, and PR command for your account. The steps below explain what those commands do.

1. Open The Prepared Practice Clone#

  1. Open the Git mission in your local Passport.
  2. Press Prepare practice folder once.
  3. Copy the displayed enter-folder command into your terminal.
  4. Keep that terminal open in the practice folder.

Run:

git status --short --branch
git remote -v

Expected result: the branch starts with practice/, the remote is your Passport exercise repository, and no unexpected file is listed.

If the button stops, run gh passport doctor. Do not create, delete, or rename practice folders to work around the error.

2. Read The Task Before Editing#

Open:

workspace/manual_task/README.md
workspace/manual_task/project-note.md

The task asks for one ## Verification heading and one sentence in project-note.md. Do this mission without an AI agent. The point is to learn the Git loop yourself before delegating Git work.

3. Make And Review The Unstaged Change#

Edit only workspace/manual_task/project-note.md, then run:

git status --short
git diff -- workspace/manual_task/project-note.md

Expected result: one modified file and only the lines you intended to add. Do not stage anything you cannot explain.

4. Stage Exactly One File#

git add -- workspace/manual_task/project-note.md
git diff --cached --check
git diff --cached

git add selects content for the next commit. git diff --cached shows that exact selection. A silent git diff --cached --check means Git found no whitespace error.

If the wrong path is staged, keep the edit but remove it from the selection:

git restore --staged path/to/wrong-file

Review again. Do not use git reset --hard.

5. Create A Conventional Commit#

git commit -m "docs(practice): explain staged diff review"

The format is type(scope): summary:

  • docs describes the kind of change;
  • practice identifies the affected area;
  • the summary states what changed.

Conventional Commits make release history easier to classify. Semantic Versioning is the separate MAJOR.MINOR.PATCH release-number convention.

6. Push And Create The Draft PR#

Return to the command list displayed by Prepare practice folder. Run its exact git push command, then its exact gh pr create ... --draft command. Do not type a guessed repository name or branch.

Expected result: GitHub opens one draft PR from practice/<your-user> to main in your public exercise fork. This is the first PR you create knowingly. The Passport's automatic background submission is separate. You do not need to understand it for this exercise.

If GitHub reports that the PR already exists, do not create another one. Run:

gh pr status

Open the existing draft PR and continue there.

7. Review What GitHub Received#

In Files changed, verify:

  • the author is your GitHub account;
  • the source branch starts with practice/;
  • the target is main;
  • exactly workspace/manual_task/project-note.md changed;
  • the commit message matches the reviewed change;
  • no secret, private data, environment, cache, or generated result appears.

Leave the PR in draft and do not merge it. Return to the Passport and press Check my work. The Passport check confirms the branch, changed paths, commit format, and draft PR through Git and GitHub.

Common Failures And Safe Recovery#

  • Unexpected local edits: inspect git status and each diff. Preserve work you understand; ask before discarding anything.
  • Wrong file staged: use git restore --staged <path>, then stage the exact intended path.
  • Push rejected: inspect the remote state; do not force-push.
  • Secret committed: revoke or rotate it immediately and report privately before attempting history cleanup.
  • PR merged accidentally: stop and ask the maintainer. Do not rewrite shared history.

Understand Before Accepting AI Output#

Do this first PR without an AI agent. If you use an AI tool only to explain an error message, do not run its proposed command until you know which files and remote state it can change. Recheck git status, the staged diff, and the GitHub PR yourself.

Completion Gate#

Continue only when the local Passport reports all four checks as passing and the draft PR still contains the one reviewed file.

Ask For Help When#

The prepared folder or branch differs from the mission, authentication changes accounts, a secret enters history, or recovery could discard work.