From Wikitech

Deploying a patch

# Merge the change

# Be in /srv/mediawiki-staging

# Check the state of things
git status

git fetch

# Make sure everything looks right
git log -n25 --oneline --decorate --graph
git log HEAD..origin/wmf/1.35.0-wmf.18
git log HEAD..origin/master

# Rebase for sec patches etc
git rebase

# If extension / submodule
git submodule update --init --recursive extensions/MyCoolExtension
git submodule update --init --recursive portals

# Test on mwdebug1002
scap pull

# Deploy to the cluster in one of the following ways on the deployment host
# Use sync-file for 5 or less files (can't do files in new directories)
scap sync-file php-1.27.0-wmf.1/api.php 'Log message here (see below)'
scap sync-file php-1.27.0-wmf.1/extensions/Foo/includes 'Log message here (see below)'
# USE SCREEN (or tmux) for SCAP SYNC!
scap sync 'Log message here'

# Note: Include the phab task ID to make bot auto comment on ticket!
# Example:
# SWAT: [[gerrit:301369|T1234 Turn on textcat based language detection for search]] PART II
# {{gerrit|301356}} T1234 Count edit conflicts for each namespace separately

Reverting a patch

# Revert on deployment host
git revert 661c36264ea2f0ec2bd931fde74554ddf7a4d376

# Sync the stuff
scap sync-file wmf-config/InitialiseSettings.php 'Revert last'

# Make sure stuff is fixed! :)

# Push the revert to gerrit and merge
git fetch

# Make sure everything looks right
git log -n25 --oneline --decorate --graph
git log HEAD..origin/wmf/1.28.0-wmf.18
git log HEAD..origin/master

# Make sure the gerrit revert matches the local revert
git diff b635f7075731f a678bc86b61

# Reset to the gerrit revert
git reset a678bc86b61