Branches Tags and Trunk

WordPress Extend conforms to the Subversion convention of splitting software projects (like plugins or themes) into three major subdirectories: branches, tags, and trunk. When you check out a copy of the code from the repository, these are the three directories you'll download. For a new project, like your plugin or theme, all the directories will be empty—just a framework to help you organize your files. To help illustrate, Figure 9-11 shows the tag and trunk directories for my Next Page plugin.

Figure 9-11. Tag and trunk files for the Next Page plugin

The trunk directory is your working copy. On a public repository, like the one for WordPress itself, the nightly builds are snapshots of the trunk. This is the copy of the code that's in active development, so it's generally not considered stable, and it's not recommended for public use. It is useful for alpha and beta testers.

Branches are for major releases. For WordPress, these are the versions that get jazz nicknames and press releases: 2.8, 2.9, 3.0. When you're ready to release a major version, create a new subdirectory under branches using the version number as the directory name. Copy the files from trunk into the branch directory and commit your changes.

The tags are the individual, minor version releases of your plugin or theme. For WordPress itself, these are the point releases containing bug fixes and security updates: 2.9.1, 2.9.2. For each minor version of your theme or plugin, you'll create a corresponding tag directory. When your trunk reaches a stable point, you'll copy the files into a new tag directory, update the readme file, and commit your changes. After that, leave the directory alone! You should maintain each release as an archival copy, not to be altered. If you want to release more changes, create a new tag.

If you're constantly improving your plugins and themes, the difference between branches and tags might be academic. If you wish, you can ignore the branches directory and keep all your releases in tags. As long as you tag the release numbers correctly in your readme files, the repository will be able to keep everything straight.

Was this article helpful?

0 0

Post a comment