Working with WordPress.org SVN Cheat Sheet

After years of building and releasing plugins on the WordPress.org repository you learn a few things about SVN usage.

Since most of us use Git via Github or similar to manage the actual code and day to day changes, we must use SVN from time to time to get a release out to the public.

I’ve put together the following cheat sheet for WordPress.org SVN usage that has some optimized commands for doing the necessary stuff very quickly.

I know there are some good Github actions and workflows to automate this, but some times it just helps to have a few quick CLI commands that work.

Hope you find them helpful.

Checkout

Checkout Trunk Only (Preferred)

If you don’t need to compare versioned tags or modify wordpress.org plugin page assets this is the ideal way to do it by only downloading the /trunk working branch.

To check out only the trunk working branch you will use the following methodology, replacing plugin-name with the correct plugin slug.

svn checkout --depth empty https://plugins.svn.wordpress.org/plugin-name/ plugin-name
svn update --set-depth infinity plugin-name/trunk

Checkout WordPress Page Assets Only

To modify banner images or plugin icons this will get the correct folder set up.

svn checkout --depth empty https://plugins.svn.wordpress.org/plugin-name/ plugin-name
svn update --set-depth infinity plugin-name/assets

Stage Changes

Remove Missing Files

Remove files that have been deleted since last release.

svn st | grep "!" | cut -d! -f2 | sed 's/^ *//' | xargs -n 500 -d "\n" -r svn rm

Add New Files

Add files that were created since last release.

svn st | grep ^? | cut -d? -f2 | sed 's/^ *//' | xargs -n 500 -d "\n" -r svn add

Fix Asset Content-Type

This only applies to the wordpress.org plugin /assets directory which needs to serve these files as images, not as binary data like the SVN repository does.

svn propset svn:mime-type image/png *.png
svn propset svn:mime-type image/jpeg *.jpg
svn propset svn:mime-type image/gif *.gif
svn propset svn:mime-type image/svg+xml *.svg
svn propset svn:mime-type image/svg+xml *.svgz

Push Changes

Commit Trunk Changes

Make sure to to run an svn st and double check everything looks right before proceeding. You would immediately follow this by tagging the release remotely, found below.

cd plugin-name/trunk
svn ci -m "Updating code to release vx.x.x"

# Example Output
> Enter your wordpress.org username
> Enter your wordpress.org password
> Sending        trunk/plugin-name.php
> Transmitting file data .................................
> Committing transaction...
> Committed revision 2687342.

Tagging Release Remotely

When working with only the /trunk branch locally this method allows first pushing the trunk updates, then remotely copying /trunk to a new versioned folder in the /tags directory on the remote SVN repository such as /tags/1.5.3.

svn copy https://plugins.svn.wordpress.org/plugin-name/trunk \
           https://plugins.svn.wordpress.org/plugin-name/tags/1.0.0 \
           -m "Tagging the 1.0.0 release"

# Example Output
> Enter your wordpress.org username
> Enter your wordpress.org password
> Committing transaction...
> Committed revision 2687342.

Quick Hacks

Update already tagged readme

Sometimes you need to update just the readme.txt file. This can be done easily with only the /trunk branch locally. Update plugin-name and 1.0.0 version according to your needs.

First modify the readme.txt file then use the following.

cd plugin-name/trunk
svn ci -m "Readme update" readme.txt

# Remove the readme in the latest tag folder.
svn rm -m "Remove outdated readme" \
		https://plugins.svn.wordpress.org/plugin-name/tags/1.0.0/readme.txt

# Copy new trunk/readme to the latest tag folder.
svn copy -m "Updating readme for existing tag" readme.txt \
		https://plugins.svn.wordpress.org/plugin-name/tags/1.0.0
           

I am a founder & CEO of Code Atlantic and I've been working with WordPress for over 15 years creating plugins to help WP site owners grow for more than 10 of those. We have developed and maintained popular plugins including the best wordpress popup plugin, Popup Maker with over 4k 5 star reviews, as well as Content Control, Ahoy & User Menus.

Follow on:

Leave a Comment





This site uses Akismet to reduce spam. Learn how your comment data is processed.