Pull Requests

The collaboration workflow

On a team, you rarely push straight to main. Instead you push a branch and open a pull request (PR) — "here are my changes, please review and merge them". It shows every commit, a line-by-line diff, and a discussion thread. The whole flow:

  1. Create a branch and commit your work.
  2. Push the branch to GitHub.
  3. Open a pull request.
  4. Teammates review and approve.
  5. Merge it into main — done.

Let's do each step, both ways.

Step 1 — branch and commit

Work on a branch, not on main

Terminal
$ git switch -c fix-typo
$ # edit files, then:
$ git add .
$ git commit -m "Fix typo in README"
In VS Code
  1. Click the branch name in the status bar → Create new branch → name it fix-typo
  2. Edit, stage with +, type a message, click ✓ Commit

Step 2 — push the branch

Put the branch on GitHub

Terminal
$ git push -u origin fix-typo
In VS Code
  1. Click Publish Branch in the Source Control panel

The -u links your local branch to the GitHub one, so later pushes are just 'git push'.

Step 3 — open the pull request

Three doors to the same room — pick whichever you have open:

Open the PR

Terminal
$ gh pr create --fill     # uses your branch's commits for title/description
$ gh pr status            # see your open PRs
$ gh pr checkout 42       # try someone else's PR locally
In VS Code
  1. On github.com, a Compare & pull request banner appears right after the push — click it
  2. Or in VS Code with the GitHub Pull Requests extension: the Create Pull Request view opens after publishing
  3. Add a title and description, then Create pull request

A good PR description explains what changed and why — it makes review faster. Run gh auth login once to connect the CLI.

Step 4 — review, update, merge

Reviewers leave comments, request changes, or approve. Need to fix something? Just push more commits to the same branch — the PR updates automatically. Once approved, click Merge pull request on GitHub, then Delete branch to keep the repo tidy. Last step: bring your own computer up to date.

After the merge: tidy up locally

Terminal
$ git switch main
$ git pull
$ git branch -d fix-typo
In VS Code
  1. Status bar → switch to main
  2. Click Sync Changes
  3. Branch picker → Delete Branch… → fix-typo

-d only deletes branches whose work is already merged — it's safe.

Issues: GitHub Issues are a to-do list for a project — bug reports, feature ideas, questions. PRs can reference an issue (e.g. "Closes #42") to auto-close it when merged.

The green ✓ — checks and Actions in 60 seconds

Next to your PR you'll often see a green check ✓ or a red ✗. That's GitHub Actions — automation the project set up so GitHub runs tasks on every push, like "run the tests" or "build the site". This is what people mean by CI (continuous integration). The recipes live in small YAML files under .github/workflows/, and the Actions tab shows every run. You don't need to write one on day one — just know that a red ✗ means a check failed, and clicking it shows exactly why.

Project hygiene: a healthy repo has a README.md (what it is, how to run it), a LICENSE (how others may use it) and a .gitignore. GitHub shows the README right on the repo's home page.

Up next: contributing to a project you don't own — forks, and keeping yours in sync.

FAQ

Frequently Asked Questions

What is a pull request?
A request on GitHub to merge your branch into another (usually main). It shows every commit, a line-by-line diff and a discussion thread, so teammates can review the change before it merges.
Can I update a pull request after opening it?
Yes — just push more commits to the same branch and the PR picks them up automatically. That's exactly how you respond to review feedback; no need to close and reopen anything.
What happens to my branch after the PR is merged?
The work now lives in main, so the branch is disposable. Click Delete branch on GitHub, then locally run git switch main, git pull, and git branch -d your-branch.
What are GitHub Actions?
Automation that runs when something happens — for example, run the tests on every push, or deploy when a PR merges to main. That's CI/CD; the green ✓ or red ✗ next to a commit is an Action reporting its result.