Fork Sync
Learn how to keep your fork synchronized with the upstream repository to receive the latest updates, bug fixes, and features.
Why Sync Your Fork?
Section titled “Why Sync Your Fork?”The original repository receives updates from other contributors. You need to sync your fork to:
- ✅ Get the latest features and bug fixes
- ✅ Stay compatible with upstream changes
- ✅ Reduce merge conflicts when contributing
- ✅ Keep your fork’s tags up-to-date
Automatic Sync (Recommended)
Section titled “Automatic Sync (Recommended)”The easiest way to keep your fork up-to-date is using the automated GitHub Actions workflow.
Setup Automatic Sync
Section titled “Setup Automatic Sync”Manual Trigger
Section titled “Manual Trigger”You can manually trigger the sync workflow:
- Go to your fork on GitHub
- Click Actions tab
- Select Sync Upstream workflow
- Click Run workflow
- Click Run workflow button
GitHub “Sync Fork” Button
Section titled “GitHub “Sync Fork” Button”GitHub provides a built-in “Sync fork” button for quick updates.
How to Use
Section titled “How to Use”- Go to your fork on GitHub
- Click “Sync fork” (appears when your fork is behind)
- Click “Update branch”
Manual Git Commands
Section titled “Manual Git Commands”For more control, you can sync your fork manually using Git commands.
Option 1: Using Taskfile (Recommended)
Section titled “Option 1: Using Taskfile (Recommended)”The project includes convenient Task commands:
# Update fork with latest changes from upstreamtask fork:update
# Sync tags from upstreamtask fork:sync-tags
# Complete fork sync (code + tags)task fork:syncOption 2: Manual Git Commands
Section titled “Option 2: Manual Git Commands”# Switch to main branchgit checkout main
# Fetch updates from upstreamgit fetch upstream
# Merge upstream changesgit merge upstream/main
# Push to your forkgit push origin main
# Sync tagsgit fetch upstream --tagsgit push origin --tagsSync Specific Branch
Section titled “Sync Specific Branch”# Fetch from upstreamgit fetch upstream
# Merge specific branchgit merge upstream/dev-main
# Push to your forkgit push origin dev-mainKeeping Feature Branches Updated
Section titled “Keeping Feature Branches Updated”When working on a feature branch, you may need to sync it with the latest upstream changes.
Update Feature Branch
Section titled “Update Feature Branch”# Switch to your feature branchgit checkout feature/my-feature
# Fetch latest from upstreamgit fetch upstream
# Merge upstream/main into your feature branchgit merge upstream/main
# Resolve any conflicts if needed# ... edit files ...git add .git commit -m "Merge upstream changes"
# Push updated branchgit push origin feature/my-featureRebase Feature Branch (Alternative)
Section titled “Rebase Feature Branch (Alternative)”# Switch to your feature branchgit checkout feature/my-feature
# Fetch latest from upstreamgit fetch upstream
# Rebase your branch on top of upstream/maingit rebase upstream/main
# Resolve any conflicts if needed# ... edit files ...git add .git rebase --continue
# Force push (rebase rewrites history)git push origin feature/my-feature --forceTroubleshooting
Section titled “Troubleshooting”Merge Conflicts
Section titled “Merge Conflicts”If you get merge conflicts when syncing:
# 1. Identify conflicting filesgit status
# 2. Edit conflicting files and resolve conflicts# Look for conflict markers: <<<<<<<, =======, >>>>>>>
# 3. Stage resolved filesgit add path/to/resolved/file.php
# 4. Complete the mergegit commit -m "Resolve merge conflicts with upstream"
# 5. Push to your forkgit push origin mainDiverged Branches
Section titled “Diverged Branches”If your fork has diverged significantly:
# Option 1: Reset to upstream (⚠️ loses your changes)git fetch upstreamgit reset --hard upstream/maingit push origin main --force
# Option 2: Create a backup firstgit branch backup-maingit reset --hard upstream/maingit push origin main --forceFailed Automatic Sync
Section titled “Failed Automatic Sync”If the automatic sync workflow fails:
- Check the workflow run in Actions tab
- Look for error messages
- Common issues:
- Merge conflicts (requires manual resolution)
- Missing
DATA_HELPERS_PATsecret - PAT expired or lacks required scopes
Best Practices
Section titled “Best Practices”Regular Syncing
Section titled “Regular Syncing”- ✅ Sync your fork regularly (at least weekly)
- ✅ Sync before starting new features
- ✅ Sync before creating pull requests
- ✅ Use automatic sync for hands-off maintenance
Tag Management
Section titled “Tag Management”- ✅ Keep tags synced with upstream
- ✅ Don’t delete upstream tags
- ✅ Use custom tag prefixes for your tags (e.g.,
custom-v1.0.0) - ✅ Document custom tags in your fork’s README
Branch Strategy
Section titled “Branch Strategy”- ✅ Keep
mainbranch clean (only upstream changes) - ✅ Create feature branches for your changes
- ✅ Regularly sync feature branches with upstream
- ✅ Delete merged feature branches
Summary
Section titled “Summary”Sync Methods:
- Automatic (Recommended) - GitHub Actions every hour
- GitHub Button - Quick one-click sync
- Taskfile -
task fork:sync - Manual Git - Full control with Git commands
What Gets Synced:
- ✅ Code changes from
upstream/main - ✅ New tags from upstream
- ✅ Branch updates
- 🔒 Your custom changes remain safe
Next Steps
Section titled “Next Steps”- Fork Setup - Initial fork configuration
- Pull Requests - Contribute changes back to upstream
- Taskfile Reference - All available Task commands