GitHub Pull Requests
A pull request (PR) is a request on GitHub to merge changes from one branch (or fork) into another, usually main. PRs are the standard way teams review and discuss code before it's merged.
A pull request shows the diff of proposed changes, allows comments on specific lines, supports automated checks, and requires approval before merging in most team workflows.
git push -u origin feature-branch
# then open a PR on GitHubOpening a pull request
Push your branch to GitHub, then click 'Compare & pull request' on the repository page. Add a title and description explaining what the change does and why.
Reviewing and merging
Teammates can comment, request changes, or approve the PR. Once approved and any checks pass, click 'Merge pull request' to bring the changes into the target branch.
git push -u origin feature-loginBranch 'feature-login' set up to track remote branch 'feature-login' from 'origin'.Pushes the feature branch to GitHub so a pull request can be opened from it.
git fetch origin
git switch main
git pullFast-forward
app.js | 12 +++++++++---After a PR is merged on GitHub, pulling main locally brings in the newly merged changes.
Key points
- A pull request proposes merging one branch into another on GitHub.
- PRs allow code review with comments before merging.
- Automated checks (like tests) can run automatically on a PR.
- Merging a PR on GitHub updates the target branch remotely.
