World map

 

BM: Baca dalam Bahasa Melayu

World 9: Power Tools · Boss challenge

Ship with gh and a Codespace

You will learn: to ship a real fix from a Codespace, using gh.

The problem

Tap each point on the timeline.

Boss time! Ship one tiny fix to your real repo. Your only tools: a Codespace and gh. Here is the route. Tap each stop.

Watch

bash
gh codespace create --repo YOUR-NAME/diary
gh codespace code --web
On your own computer: gh codespace create makes a Codespace for your diary repo. Then gh codespace code --web opens it in the browser.

Stop 1: open a Codespace on your diary repo. Run these two commands, or use the Code button on GitHub. Codespaces need a GitHub account and have usage limits.

Try it

Inside the Codespace, what comes next? Put the stops in order.

First step at the top. Put these in order. Use the arrows, or drag.

  • Fix the typo in README.md
  • Run gh pr create
  • Commit the fix
  • Push the branch
  • Make a branch: git switch -c fix-typo

Try it

Build the command that opens the pull request. Let it reuse your commit message.

Tap the pieces in the right order.

…

Watch

bash
git push -u origin fix-typo
gh pr create --fill
https://github.com/YOUR-NAME/diary/pull/1
git push sends the fix-typo branch to GitHub. Then gh pr create --fill opens the pull request and prints its link.

Stops 4 and 5: push, then gh pr create. It prints a link to your new pull request. The default Codespace already has gh, signed in for this repo.

Predict

You used --fill. Where do the pull request’s title and body come from?

Pick one answer.

Try it

Now do it for real. Tick each step as you go.

Mission: ship it

  1. gh repo create diary --public --add-readme
  2. gh codespace create --repo YOUR-NAME/diary
  3. git switch -c fix-typo
  4. git commit -am "docs: fix typo in README"
  5. git push -u origin fix-typo
  6. gh pr create --fill
  7. gh codespace stop

0 of 8 steps done · Your ticks are saved.

Check

Can GitHub see your work? Type your username and check.

Check it on GitHub

Your username is sent only to api.github.com.

  • Your diary repo is publicNot checked yet
  • GitHub sees your pull request in diaryNot checked yet

You did it!

You can now ship a fix from a Codespace, using gh.

Go deeper (optional)

Happy with it? Merge from the terminal with gh pr merge. Once your work is pushed, gh codespace delete removes the Codespace. No Codespace? Press . on your repo for github.dev. Commit to a new branch there. Then open the pull request in the browser.