The handbook/GitHub basics
Reading settingsOfficial docs ↗

03 / Save and review your work

GitHub, without
the guesswork.

Understand repositories, branches, commits, and pull requests through one small practice project.

STEP-BY-STEP HANDBOOK15–20 min walkthrough

Git and GitHub are different

Git keeps change history on your computer. GitHub hosts repositories online and adds collaboration, pull requests, and automated checks. You can use Git without GitHub. The normal browser-based Claude Code onboarding uses GitHub.

01 / WORKMake a branchKeep your proposed changes separate from main.
02 / SAVECommit and pushSave a snapshot, then upload the branch.
03 / REVIEWOpen a pull requestCheck the difference before merging.

Create your first repository in the browser

Create a GitHub account

Sign in at github.com. Enable two-factor authentication for the account.

Create the repository

Use New repository. Name it claude-practice, select Private, and initialize a README. A license controls how others may reuse code; choose one deliberately if you later publish your project.

Connect it to Claude

Follow the browser walkthrough. For a local workflow, install Git and optionally the GitHub CLI, then clone your repository.

Use the same project locally

Install Git and, for the gh commands, GitHub CLI. Replace YOUR-USERNAME with your real GitHub name.

Terminal
gh auth login
gh repo clone YOUR-USERNAME/claude-practice
cd claude-practice
git switch -c learn/first-change
claude --permission-mode plan

Claude’s login and GitHub’s login are separate. gh auth login authorizes GitHub operations. Do not paste the resulting token into chat.

Save, push, and review

After your change, inspect the diff before staging. The example assumes you changed README.md; substitute the files you intentionally want to include.

Terminal
git status
git diff
git add README.md
git diff --cached
git commit -m "Clarify project setup"
git push -u origin learn/first-change
gh pr create --base main --title "Clarify project setup" --body "Adds beginner setup instructions."

If Git requests an identity, configure user.name and user.email with your own details. GitHub provides a no-reply email if you prefer to keep your address private.

CommandPlain-English meaning
git statusWhich branch am I on, and which files changed?
git diffWhat unstaged lines changed?
git add FILESelect a file’s changes for the next snapshot.
git commitCreate a local snapshot.
git pushSend commits to the remote repository.
git pull --ff-onlyBring in remote changes only when Git can move forward without making a merge commit.
gh pr viewInspect the pull request associated with this branch.
gh pr checksCheck the pull request’s automated checks.

Before you merge

  • Read all changed files, including configuration and dependency changes.
  • Check test results for the latest commit, not an earlier green run.
  • Try the visible behavior yourself. A green test does not prove the whole app works.
  • Resolve review feedback and conflicts. Ask for an explanation before accepting unfamiliar changes.
  • Merge in GitHub once satisfied. Then update your local main branch.
Terminal, after the PR is merged
git switch main
git pull --ff-only

If something goes wrong

Stop before running destructive commands. git status and git diff help identify the state. For a shared commit, ask about a reviewed git revert rather than rewriting shared history. Uncommitted edits need separate care; not every deleted file can be recovered.

Keep secrets out of Git

Add local secret files such as .env to .gitignore, but remember this does not remove files already tracked. If a credential was committed, rotate it immediately; deleting the visible line does not remove it from history.

Official references: GitHub Hello World ↗ · Getting started with Git ↗ · GitHub Actions integration ↗

Was this chapter useful?

Report an error

Votes are shared only if you enable optional measurement in Privacy settings.

CONTINUE THE GUIDEPrompt & command builder

Edit this example

Changes here affect this copy only. Nothing runs from this site. Closing this window discards your edits.

Search the field guide

Search all chapters and FAQ answers. Use Tab to reach a result and Enter to open it.