Jake Paris

How to use SVN for updating WordPress plugins

I’m a git user, and I always forget how to use SVN to update my WordPress plugins for the official plugins repository listing. Here is a reminder to myself. This assumes you have svn installed on your system already.

The first thing is to make the updates in the git tracked folder. Don’t make them directly in the svn repo, as you will fall into a nightmare of “which one did I update” and “oh I messed up and need to make a fix in both places”. I speak from experience. Also, don’t forget to increment the plugin version in readme.txt’s “Stable Tag” as well as the plugin header file’s “Version” .

Once you’re done in the git tracked folder…

  1. Get the plugin repository url. You can get this by navigating to the “development” tab on the plugin’s public page, or you can just visit https://plugins.svn.wordpress.org/{plugin-slug}/
  2. Run svn checkout {repository-url} to place the svn repo on your machine.
  3. Copy your updated files and directories into the /trunk/ directory. Be sure not to carry over the .git directory, your editor config, or stuff like that.
  4. In order to create the new tag folder in the /tags/ directory, run svn copy /trunk /tags/{version-number} from the plugin root. According to the WordPress SVN guide, this is actually important.
  5. Make sure you run svn status to see what needs adding to the tracked files. Anything with a ? as the status marker on the left of the list needs to be added (use svn add to add files to the repo).
  6. svn commit and create your commit message. This will automatically push the repository as well. You will be asked for your wordpress.org password, then the commit is pushed.

Basic SVN Commands

svn status (same as git)

svn update Pulls down latest from remote. Will keep local modifications where possible.

svn diff (same as git)

svn revert {filename} This discards local modifications.

svn rm Remove file from repository

svn rename

svn add This adds files to the respository that weren’t previously tracked.

svn commit This commits any changes and opens the editor for a message. Just like with git, you can pass a -m "message here" flag. Note: When the commit is, well, committed, the repo is automatically pushed to the remote.

Leave a Reply

Your email address will not be published.