Skip to content

Update a development wiki

Releasev0.35.0 · cfeceb67

This workflow updates a configured MediaWiki checkout, reviews the source changes, then updates dependencies and database schemas. First set up a wiki and select the development context you want to update. Review or back up any development data you need before running schema changes.

For update modes, skipped repositories, saved changes, and failure behavior, read mw dev mediawiki update-code --help.

Preview which checkouts are eligible without fetching or changing them:

Terminal window
mw dev mediawiki update-code --dry-run

Check the reported branches and skipped repositories. Then fast-forward eligible clean checkouts:

Terminal window
mw dev mediawiki update-code

For uncommitted work you want reapplied after updating, use this instead:

Terminal window
mw dev mediawiki update-code --mode=stash

Review the results before continuing. In the core checkout and any extensions or skins you changed, inspect the working tree and recent commits:

Terminal window
git status --short
git log -5 --oneline
git diff
git diff --cached

Source updates are independent: an error does not undo repositories that already updated. Resolve failures and review skipped repositories before updating shared dependencies or running maintenance.

With the environment running, update PHP dependencies after reviewing the source changes:

Terminal window
mw dev mediawiki composer update --no-interaction

Alternatively, mw dev mediawiki update-code --composer combines source and Composer updates, running Composer only when all checkouts succeed with none skipped. Review its output before proceeding to database maintenance.

Update the configured development wikis:

Terminal window
mw dev mediawiki foreachwiki update.php -- --quick

Check the maintenance output, then open your wiki and verify the features you are developing. Composer and database changes are separate from Git recovery; restoring source refs does not reverse either of them.

If you deliberately want to switch to the remote default branch and leave local changes saved, preview mop mode before using it:

Terminal window
mw dev mediawiki update-code --mode=mop --dry-run
mw dev mediawiki update-code --mode=mop

In each affected repository, use the exact refs printed by the command. The following placeholders stand for those printed refs. Inspect the saved work before applying it:

Terminal window
git show --stat <printed-original-ref>
git stash show --stat <printed-stash-ref>

To preserve the old commit on a named branch:

Terminal window
git branch recovered-work <printed-original-ref>

To reapply saved changes to your current checkout, start from a clean worktree and use:

Terminal window
git stash apply --index <printed-stash-ref>

Resolve any conflicts and inspect git status and git diff before continuing. If the CLI reports recovery-needed, inspect the repository and its printed recovery refs first; do not assume it restored the original state.


Read this guide offline with mw help guides dev update-code.

Report an issue with this page

Report a documentation issue

The report includes this page’s link, section and documentation version.

Review and submit on Phabricator, or run the command using your saved CLI profile. The command asks before creating the task.