Pull Requests
Learn how to create pull requests to contribute your changes back to the Data Helpers repository.
When to Create a Pull Request
Section titled “When to Create a Pull Request”Create a pull request when you want to:
- ✅ Add a new feature
- ✅ Fix a bug
- ✅ Improve documentation
- ✅ Refactor code
- ✅ Add or improve tests
Prerequisites
Section titled “Prerequisites”Before creating a pull request:
- ✅ You have a fork of the repository
- ✅ Your fork is up-to-date with upstream
- ✅ You have set up your development environment
- ✅ You understand the project’s coding standards
See Fork Setup and Fork Sync for details.
Step-by-Step Guide
Section titled “Step-by-Step Guide”Step 1: Setup Development Environment
Section titled “Step 1: Setup Development Environment”# Install Composer dependenciescomposer install
# Install Task (if not already installed)# See: https://taskfile.dev/installation/
# Verify setuptask --listStep 2: Create a Feature Branch
Section titled “Step 2: Create a Feature Branch”Always create a new branch for your changes. This keeps your main branch clean and makes it easier to work on multiple features simultaneously.
# Update your fork firsttask fork:update
# Create and switch to a new branchgit checkout -b feature/my-awesome-featureBranch Naming Conventions:
feature/- New featuresfix/- Bug fixesdocs/- Documentation changesrefactor/- Code refactoringtest/- Test additions or changes
Step 3: Make Your Changes
Section titled “Step 3: Make Your Changes”Edit files using your favorite editor:
# Example: Edit a filevim src/DataAccessor.php
# Example: Add a new testvim tests/Unit/DataAccessorTest.phpStep 4: Test Your Changes
Section titled “Step 4: Test Your Changes”Run all tests:
# Using Tasktask test:run
# Or directly with Pestvendor/bin/pestRun specific tests:
# Test specific filevendor/bin/pest tests/Unit/DataAccessorTest.php
# Test specific methodvendor/bin/pest --filter testGetMethodCheck code style:
# Check code styletask quality:ecs:check
# Fix code style automaticallytask quality:ecs:fixRun static analysis:
task quality:phpstanStep 5: Commit Your Changes
Section titled “Step 5: Commit Your Changes”Stage your changes:
# Stage all changesgit add .
# Or stage specific filesgit add src/DataAccessor.php tests/Unit/DataAccessorTest.phpCommit with a descriptive message:
git commit -m "feat: add support for wildcard iteration"Commit Message Format:
feat:- New featurefix:- Bug fixdocs:- Documentation changesrefactor:- Code refactoringtest:- Test changeschore:- Maintenance tasks
Examples:
git commit -m "feat: add DataFilter::whereIn() method"git commit -m "fix: resolve null pointer in DataAccessor::get()"git commit -m "docs: update installation instructions"git commit -m "test: add tests for wildcard iteration"Step 6: Push to Your Fork
Section titled “Step 6: Push to Your Fork”# Push your branch to your forkgit push origin feature/my-awesome-featureFirst time pushing a new branch:
# Git will suggest setting upstreamgit push --set-upstream origin feature/my-awesome-feature
# Or use the shorthandgit push -u origin feature/my-awesome-featureStep 7: Create the Pull Request
Section titled “Step 7: Create the Pull Request”-
Go to your fork on GitHub:
https://github.com/YOUR-USERNAME/data-helpers -
GitHub will show a banner suggesting to create a pull request
-
Click “Compare & pull request”
-
Fill in the PR details:
- Title: Clear, descriptive title
- Description: Use the template below
- Base:
event4u-app/data-helpersmain - Compare:
YOUR-USERNAME/data-helpersfeature/my-awesome-feature
-
Click “Create pull request”
PR Description Template
Section titled “PR Description Template”## DescriptionBrief description of what this PR does.
## Changes- Added feature X- Fixed bug Y- Updated documentation Z
## Testing- [ ] All tests pass- [ ] Added new tests for new features- [ ] Manually tested the changes
## Related IssuesFixes #123Responding to Review Feedback
Section titled “Responding to Review Feedback”Make Requested Changes
Section titled “Make Requested Changes”# Make the requested changesvim src/DataAccessor.php
# Test your changestask test:run
# Commit the changesgit add .git commit -m "fix: address review feedback"
# Push to update the PRgit push origin feature/my-awesome-featureThe PR updates automatically when you push to the same branch.
Amend Last Commit (Optional)
Section titled “Amend Last Commit (Optional)”If you want to keep a clean commit history:
# Make changesvim src/DataAccessor.php
# Stage changesgit add .
# Amend the last commitgit commit --amend --no-edit
# Force push (rewrites history)git push origin feature/my-awesome-feature --forceAfter Your PR is Merged
Section titled “After Your PR is Merged”Clean Up Your Branch
Section titled “Clean Up Your Branch”# Switch back to maingit checkout main
# Update your forktask fork:update
# Delete the feature branch locallygit branch -d feature/my-awesome-feature
# Delete the feature branch on your forkgit push origin --delete feature/my-awesome-featureStart a New Feature
Section titled “Start a New Feature”# Make sure main is up-to-datetask fork:update
# Create a new feature branchgit checkout -b feature/next-awesome-featureCommon Workflows
Section titled “Common Workflows”Starting a New Feature
Section titled “Starting a New Feature”Using Task commands:
# 1. Update forktask fork:update
# 2. Create feature branchgit checkout -b feature/my-feature
# 3. Make changes and testtask test:run
# 4. Commit and pushgit add .git commit -m "feat: add new feature"git push -u origin feature/my-feature
# 5. Create PR on GitHubUpdating an Existing PR
Section titled “Updating an Existing PR”# 1. Make changesvim src/SomeFile.php
# 2. Testtask test:run
# 3. Commit and pushgit add .git commit -m "fix: address review comments"git push origin feature/my-featureSyncing PR with Upstream
Section titled “Syncing PR with Upstream”If upstream has changed while your PR is open:
# 1. Fetch upstreamgit fetch upstream
# 2. Merge upstream/main into your branchgit merge upstream/main
# 3. Resolve conflicts if any# ... edit files ...git add .git commit -m "Merge upstream changes"
# 4. Push (PR updates automatically)git push origin feature/my-featureBest Practices
Section titled “Best Practices”Before Creating a PR
Section titled “Before Creating a PR”- ✅ Sync your fork with upstream
- ✅ Create a feature branch (don’t use
main) - ✅ Write clear, descriptive commit messages
- ✅ Run all tests and ensure they pass
- ✅ Fix code style issues
- ✅ Update documentation if needed
PR Content
Section titled “PR Content”- ✅ Keep PRs focused (one feature/fix per PR)
- ✅ Write a clear description
- ✅ Reference related issues
- ✅ Include tests for new features
- ✅ Update documentation
- ✅ Keep commits clean and logical
During Review
Section titled “During Review”- ✅ Respond to feedback promptly
- ✅ Be open to suggestions
- ✅ Ask questions if unclear
- ✅ Keep the PR updated with upstream
- ✅ Mark conversations as resolved
After Merge
Section titled “After Merge”- ✅ Delete your feature branch
- ✅ Update your fork
- ✅ Celebrate! 🎉
Troubleshooting
Section titled “Troubleshooting”PR Has Conflicts
Section titled “PR Has Conflicts”# 1. Update your branch with upstreamgit fetch upstreamgit merge upstream/main
# 2. Resolve conflicts# ... edit files ...git add .git commit -m "Resolve merge conflicts"
# 3. Pushgit push origin feature/my-featureTests Failing in CI
Section titled “Tests Failing in CI”- Check the CI logs in the PR
- Run tests locally:
task test:run - Fix the issues
- Commit and push
Code Style Issues
Section titled “Code Style Issues”# Fix automaticallytask quality:ecs:fix
# Commit the fixesgit add .git commit -m "style: fix code style"git push origin feature/my-featureSummary
Section titled “Summary”Complete workflow:
- ✅ Setup development environment
- ✅ Create feature branch
- ✅ Make changes
- ✅ Test thoroughly
- ✅ Commit with clear messages
- ✅ Push to your fork
- ✅ Create pull request
- ✅ Respond to feedback
- ✅ Clean up after merge
Quick commands:
# Update forktask fork:update
# Create branchgit checkout -b feature/my-feature
# Testtask test:run
# Fix code styletask quality:ecs:fix
# Commit and pushgit add .git commit -m "feat: add feature"git push -u origin feature/my-featureNext Steps
Section titled “Next Steps”- Contributing Guide - Learn about code style and testing
- Development Setup - Setup your development environment
- Test Matrix - Learn about testing
- Taskfile Reference - All available Task commands