Learning Pull Requests! - bounswe/bounswe2025group10 GitHub Wiki
π¦ Pull Requests (PR) β What They Are & How to Use Them
π Index
- π Why Use Pull Requests?
- π§ How to Create a Pull Request
- π PR Review Process
- π§ͺ Example Workflow
- π After Your PR is Merged
- π§ Extra Tip: Draft Pull Requests
π Why Use Pull Requests?
- β Code Review: Enables teammates to review your changes before merging.
- π History: Documents why and how changes were made.
- π Collaboration: Enables discussion, suggestions, and improvements.
- π‘οΈ Safety: Prevents direct edits to critical branches like
main
.
π§ How to Create a Pull Request
-
Create a New Branch from
main
or another base:git checkout -b feature/your-feature-name
-
Make your changes in the project, then commit them:
git add . git commit -m "Add: meaningful description of the changes"
-
Push your branch to the remote:
git push origin feature/your-feature-name
-
Go to GitHub β Your Repository, and youβll usually see a prompt:
"Compare & pull request"
Click it.
-
Fill in the Pull Request form:
- Title: Short, clear description of the feature or fix.
- Description: What did you change? Why? How does it work?
- Base branch:
main
- Compare branch:
feature/your-feature-name
-
Click "Create Pull Request"
π PR Review Process
Once the pull request is created:
- Team members can review your changes.
- They may approve, request changes, or comment on specific lines.
- Once approved, the PR can be merged into the base branch by a team member (or you).
π§ͺ Example Workflow
# Step 1: Create a new branch
git checkout -b feature/docker-setup
# Step 2: Make your changes
# Step 3: Commit changes
git add .
git commit -m "Add: Docker support for mobile development"
# Step 4: Push the branch
git push origin feature/docker-setup
# Step 5: Open GitHub and create a pull request from feature/docker-setup β main
π After Your PR is Merged
To keep your local main branch up to date:
git checkout main
git pull origin main
π§ Extra Tip: Draft Pull Requests
If you're still working but want early feedback:
- Click "Create draft pull request"
- Reviewers will know itβs not ready to be merged yet, but they can comment and help you improve it.