-
Notifications
You must be signed in to change notification settings - Fork 207
GitHub Pull Requests
Mudassir Shabbir edited this page Jul 30, 2024
·
1 revision
This guide will help new developers understand how to author, merge, and review pull requests (PRs) within our organization’s repository. It covers the merging process, and best practices for both authors and reviewers.
-
Open a PR whenever you want to share your code:
- You can open a PR at any stage of your work.
- If your PR is not ready for review, mark it as a draft and do not assign reviewers.
-
Clear Intent for Draft PRs:
- Indicate if a draft PR is ready for preliminary review despite being marked as a draft.
-
Commit Management:
- Once a review has started, avoid rebasing, squashing, or amending commits.
- Do not rebase onto a more recent target unless necessary. Merge the target branch into your PR branch if needed.
-
New Commits for Feedback:
- Address review feedback by adding new commits.
- Keep these commits focused and narrow in scope.
- Let reviewers mark feedback as resolved.
-
Use GitHub UI:
- Prefer the GitHub UI for responding to feedback for better context and to avoid missed comments.
-
Cleaning Up:
- After approval, you can squash or rebase to clean up commit history if necessary.
-
Automated Merging:
- We use Mergify to manage the merging process.
- Mergify is subject to the same branch protection rules and is triggered by specific labels.
-
Avoid Manual Merge:
- Do not use the GitHub UI merge button. Use the automerge labels instead for fairness and consistency.
-
Required Approvals and Checks:
- A PR must be approved by at least one reviewer.
- All required status checks must pass.
- The PR must be up-to-date with the target branch.
-
Reviewer Assignment:
- Assign reviewers when the PR is ready.
- Avoid assigning too many reviewers and be clear about the scope of the review.
-
Commit Handling:
- Add new commits for changes instead of amending existing ones.
- Indicate feedback consideration using comments or emojis.
-
Comprehensive Review:
- Review the code, comments, PR description, and commit structure.
- You share ownership of the code with the author once you approve.
-
Feedback Classification:
- Fix: Must be fixed and re-reviewed.
- Fix & Ship: Must be fixed but no need for another review.
- Optional/Nit: Suggested changes at the author's discretion.
- Question: Clarification needed.
-
Constructive Feedback:
- Provide actionable feedback with a clear description of issues and suggested fixes.
-
Small and Targeted:
- PRs should be focused and linked to relevant issues.
- Include a complete PR description and a clear title.
-
Test Coverage:
- Ensure that tests cover the changes made.
-
Ease of Review:
- Break changes into small, logical commits.
- Avoid mixing refactoring with behavioral changes.
-
Automerge Labels:
- Use
automerge:squash
for small, single-commit PRs. - Use
automerge:rebase
for larger PRs.
- Use
-
Conventional Commits:
- Use clear and descriptive commit messages and PR titles.
- Follow the conventional commit format if applicable.