When working with WordPress core, you often have to go back and forth through commits, scroll or search through revision logs, switch between tags and branches and so on. This can be annoying with a slow Internet connection and impossible without a connection at all, but what if you’re working on a core patch on a plane or a submarine?
It’s probably a no-brainer, but this totally blew my brains out. Apparently you can use Subversion with GitHub repositories! So if you’re a fan of Subversion externals, and like to include themes and plugins using
svn:externals like this:
akismet http://plugins.svn.wordpress.org/akismet/tags/2.5.6/ jetpack http://plugins.svn.wordpress.org/jetpack/tags/1.7/
You’re gonna love the fact, that if the theme or plugin is not hosted in a Subversion repository, but on GitHub only (such as the _s theme), you can still include it with
svn:externals like so:
And every time you
svn update, Subversion will pull the latest version of the Underscores theme directly from GitHub. Boom!
Unfortunately this doesn’t seem to work vice-versa. According to this thread, it’s not possible to set up a Subversion repository as a Git submodule. However, you can mirror things, just like the WordPress mirror on GitHub!
What about you? What’s your current workflow with WordPress themes and plugins? Do you use external references, or do you keep a copy of themes and plugin files in your own code base, and update them when updates ship? Share your thoughts in the comments section and have a great weekend!
Since I had to clean up all the mess in my SVN repo today, I’d like to show you some nifty tricks ;) First of all, I encourage all Windows users to forget about TortoiseSVN and all the other GUI versions, cause there’s nothing better than the good old plain-console subversion client. Just add it to your %PATH% system variable and you’ll be able to use svn commands from anywhere in the Windows command line.
Okay, cleaning up. During any cleanups and reordering subversion repos you’ll encounter with moving, renaming and deleting files. And here’s my favourite South Park phrase – “Just don’t mess up okay? You’re messing up too much!”. Do NOT delete, rename or move files thourgh your Windows explorer. The right way to do it is using SVN commands:
svn rename oldfile.php newfile.php
svn move oldfolderfile.php newfolderfile.php
svn remove unwantedfile.php
Yes, and the file will be removed/renamed/moved on your local working copy, then in the repo after you commit changes. Anyways, if you do mess up, you can always throw everything to your trashcan and start over with a fresh checkout (I’ve got a lot of temp folders full of these ;).
And of course property setting (propset) and removing (propdel) when it comes to svn:ignore properties. Properties in SVN are applied to the directory you pick and will not apply to its subdirectories, so be careful. Here’s how you set the svn:ignore property (for filename.php) on a folder:
svn propset svn:ignore "filename.php" folder
And here’s how you remove it:
svn propdel svn:ignore folder
That’s about all I had to say. Oh and don’t forget to cleanup sometimes:
And since I’m a NetBeans fan, I just have to say that NetBeans IDE is just great when it comes to version control. It supports both CVS and SVN repos and it’s real quick at getting the job done if you split up your sources into NetBeans projects. It has an in-built repo browser, diff viewer and others. And it’s just a one-click-view-changes-and-commit ;) I love it. Go get yours: netbeans.org.