Dualo
Git & GitHub

Pull Requests on GitHub

A PR is a proposal to merge your branch into another. GitHub shows the diff, runs CI, and lets reviewers comment line-by-line before approving.

1 min read

A Pull Request (PR) is GitHub's way of saying: 'I have a branch with changes — please review and merge it into this other branch'. It's not a Git concept, it's a GitHub workflow built on top of Git.

Typical flow:

  1. git switch -c feature/login
  2. Make commits, git push -u origin feature/login
  3. On GitHub, click 'Compare & pull request' (or gh pr create from CLI)
  4. Reviewers comment, you push more commits to address feedback (the PR auto-updates)
  5. Approval → 'Merge' button → done

Three merge buttons on GitHub:

  • Merge = creates a merge commit (preserves the branching shape)
  • Squash and merge = collapses your commits into one before merging (clean main history)
  • Rebase and merge = replays your commits on top of main, no merge commit

PR title + description matter. The title becomes the merge commit subject. Describe why you made the change (the 'what' is in the diff). Link related issues with Closes #123 — GitHub auto-closes the issue when the PR merges.

After merge: delete the branch (GitHub offers a button). The history stays — branches are just labels. Locally: git switch main && git pull && git branch -d feature/login to clean up.

Practice

Using the GitHub CLI (`gh`), open a PR for the current branch with title "Add login" and body "Closes #42".

Practice

After your PR is merged, clean up locally:

git switch git pull git branch feature/login

Grounded on https://docs.github.com/en/pull-requests/collaborating-with-pull-requests