Pull Requests
What is a Pull Request?
A pull request (PR) is a way to propose changes to a repository. It lets you tell others about changes you've pushed and request review before merging.
Workflow
1. Create a Branch
git checkout -b feature/my-new-feature
2. Make Changes
Edit your code and commit:
git add .
git commit -m "Add new feature"
git push origin feature/my-new-feature
3. Open Pull Request
- Navigate to the repository
- Click "Pull Requests" → "New Pull Request"
- Select:
- Base branch: The branch you want to merge into (e.g.,
main)
- Compare branch: Your feature branch (e.g.,
feature/my-new-feature)
- Fill in:
- Title: Clear, descriptive title
- Description: What and why you're changing
- Click "Create Pull Request"
Pull Request Features
Code Review
Reviewers can:
- View diffs: See all changes
- Comment: Leave general or inline comments
- Request changes: Ask for modifications
- Approve: Accept the changes
Conversation
- Discuss the proposed changes
- Ask questions
- Provide feedback
- Tag team members using
@username
Checks
- View CI/CD status
- Check for merge conflicts
- See commit history
Merge Options
- Merge: Combine commits
- Squash and Merge: Combine all commits into one
- Rebase and Merge: Rebase commits onto base branch
Best Practices
For Authors
- ✅ Keep PRs small and focused
- ✅ Write clear descriptions
- ✅ Add screenshots for UI changes
- ✅ Link related issues
- ✅ Respond to review feedback
- ✅ Update your branch if needed
For Reviewers
- ✅ Review promptly
- ✅ Be constructive and respectful
- ✅ Test the changes locally if needed
- ✅ Use inline comments for specific code
- ✅ Approve when satisfied
- ✅ Request changes when necessary
Resolving Conflicts
If there are merge conflicts:
# Fetch latest changes
git fetch origin
# Rebase your branch
git rebase origin/main
# Resolve conflicts manually
# Edit conflicted files
# Continue rebase
git add .
git rebase --continue
# Push changes
git push origin feature/my-new-feature --force
Managing Pull Requests
Labels
Use labels to categorize PRs:
bugfix - Fixes a bug
enhancement - New feature
documentation - Doc updates
breaking - Breaking changes
wip - Work in progress
Milestones
Associate PRs with project milestones to track progress.
Assignees
Assign reviewers and responsible persons.
Next Steps