Upstream Synchronization
Overview
To ensure the UditAkhourii/wordpress repository remains compatible with the latest security updates, bug fixes, and feature enhancements from the official WordPress core, users must periodically synchronize with the upstream repository.
Maintaining alignment allows you to leverage stable core updates while maintaining your custom MVP enhancements and weekly contributions.
Configuring the Upstream Remote
Before synchronizing, you must define the official WordPress core repository as a remote source. This allows your local environment to track changes from the official source.
Run the following command in your terminal:
git remote add upstream https://github.com/WordPress/WordPress.git
To verify your configuration, run:
git remote -v
The output should list upstream pointing to the official WordPress repository.
Synchronizing with Core
Follow these steps to pull the latest changes from the official WordPress core into your local development branch.
1. Fetch Latest Changes
Retrieve the latest branches and tags from the upstream without modifying your local code.
git fetch upstream
2. Merge Upstream Updates
Switch to your main development branch (e.g., master or develop) and merge the upstream changes. Usually, you will want to sync with the latest stable branch or a specific version tag.
git checkout develop
git merge upstream/master
Applying Official Patches
In some cases, you may need to apply specific patches from the WordPress Trac or a Core Pull Request before they are merged into the main branch.
Using Patch Files
If you have a .patch or .diff file from a Trac ticket:
# Check if the patch can be applied cleanly
git apply --check path/to/core-patch.patch
# Apply the patch
git apply path/to/core-patch.patch
Merging Specific PRs
To test a contribution currently in review on the official WordPress repository:
git fetch upstream pull/ID/head:local-patch-branch
git checkout local-patch-branch
Replace ID with the Pull Request number.
Verification and Conflict Resolution
Since this repository contains custom MVP logic, merge conflicts may occur during synchronization, particularly in core configuration files or modified templates.
Conflict Resolution Strategy
- Identify Conflicts: Git will mark files with conflicts during the
mergeprocess. - Prioritize Core Security: Always prioritize
upstreamchanges for security-related files (e.g.,wp-includes/registration.php). - Verify Integrity: After resolving conflicts, run your local test suite to ensure the MVP functionality remains intact.
Internal Sync Scripts
While the primary interface for synchronization is Git, this repository includes internal utility scripts located in bin/ (e.g., sync-check.sh). These are internal tools used to validate that the current build matches the specific WordPress core version defined in your environment configuration. They do not require manual execution unless you are modifying the deployment pipeline.