Pull Requests
A Pull Request (PR) is a way to notify team members that you've completed a feature or fixed a bug. It's a request to merge your changes from one branch (compare) into another branch (base). PRs are crucial for code review and team collaboration, allowing discussion and refinement of code before it's merged into the main codebase.
Use Cases:
Creating and Managing Pull Requests:
1. Create a feature branch locally:
git checkout -b feature-branch
Always work in a separate branch for PRs
2. Push branch to remote:
git push origin feature-branch
Make your changes available on GitHub
3. Create PR on GitHub:

Step 1: Access Pull Request Creation

Navigate to your repository on GitHub. If you recently pushed changes, you'll see a "Compare & Pull Request" button.

Compare & Pull Request button after recent changes

Step 2: Select Branches

If no "Compare & Pull Request" button appears, click the "New pull request" button and select your branches.

Branch selection dropdowns

Step 3: Review Changes

Review the comparison between branches, including commits and changed files.

Branch comparison view showing commits and files

Step 4: Finalize Pull Request

Add a descriptive title and detailed description explaining your changes. Then click "Create pull request" to submit.

Pull request creation form with title and description

Important Notes:

  • Base branch is typically 'main' (where you want to merge TO)
  • Compare branch is your feature branch (where your changes are)
  • Write clear titles and descriptions to help reviewers understand your changes
  • Review all changes before submitting to ensure everything is included
4. Update PR after feedback:
git add .
git commit -m "Address PR feedback"
git push origin feature-branch
The PR updates automatically when you push changes
5. Handling reviewer comments:
# View PR comments on GitHub
# Respond with:
- 👍 to acknowledge
- Add follow-up comment
- "Resolve conversation" when fixed
6. Final PR checks:
# Before merging, ensure:
- All comments resolved
- Required reviews completed
- All changes tested locally
- No merge conflicts
Best Practices: