Advanced Pull Request (PR) Lab
⚙️ This lab provides a detailed, hands-on workflow for creating, reviewing, and merging pull requests (PRs) in GitHub, following best practices for collaboration.
Experimental
This lab is designed to help you understand and practice the advanced features of pull requests in GitHub.
1. Cloning the Repository
-
Clone the repository you want to contribute to:
2. Creating a New Branch
-
Create and switch to a new branch for your feature or fix:
3. Making Your Changes
-
Edit files, add features, fix bugs, or update documentation as needed in your new branch.
4. Pushing Your Branch to GitHub
-
Push your branch to GitHub (first push requires
--set-upstream):
5. Creating the Pull Request
- Go to your repository on GitHub.
- You should see a
Compare & pull requestbanner. - Click it, or go to the “Pull requests” tab and click
New pull request. - Fill out the PR form (Not all fields are required, but the more information you provide, the better):
- Base branch: The branch you want to merge into (usually
main) - Compare branch: Your feature branch
- Title: Clear, concise summary of your changes
- Description: Explain what and why, reference issues (e.g.,
Closes #123), add screenshots or context as needed - Reviewers/Assignees/Labels: Add as appropriate
- Linked Issues: Link any related issues or PRs
- Base branch: The branch you want to merge into (usually
- Review your changes and submit the PR.
6. Reviewing and Merging
- If you can review your code, leave comments, and some request changes
- Leave comments on specific lines of code for clarity
- Push new commits to your branch (they appear in the PR automatically)
- Approve the PR and merge it
8. Cleaning Up
After merging:
- Delete the remote branch on GitHub (GitHub will prompt you)
- Delete your local branch:
Best Practices & Tips
- Always branch from the latest
main/master - Write clear commit messages and PR descriptions
- Reference related issues in your PR
- Respond promptly to review feedback
- Keep PRs focused and small for easier review