At WordCamp London last week I made my first contribution to WordPress – a bug fix for the Twenty Fourteen theme that’s being released with WordPress 3.8. Part of doing this involved created a patch.
Now I know this is pretty basic stuff – but having not contributed to other projects before it’s not something I had experience with. So I set about finding out how to do it. Since I use Netbeans my first attempt was to export the patch there – however Netbeans broke my code formatting (swapping tabs for spaces and, bizarrely, adding a space at the end of each line), and so this meant my code didn’t match the WordPress coding standards.
As such I had to break out the terminal and use that. The command to create the patch was quite straight forward, however there were a couple of things I wanted to do differently. Specifically I wanted to create a patch for just two files and not the whole directory. I also had to set the project root as the WordPress root.
In the end the command I ran was the following:
svn diff wp-content/themes/twentyfourteen/style.css wp-content/themes/twentyfourteen/rtl.css > ~/Desktop/TwentyFourteenMenu.patch
One thing to note – I had recently upgraded to Mavericks, which included updating Xcode. The first time I executed the svn diff command I got the following error.
Agreeing to the Xcode/iOS license requires admin privileges, please re-run as root via sudo.
The fix was easy – all I had to do was run Xcode and accept the latest Terms and Conditions.
Was it good/ useful/ a load of old rubbish? Let me know on Mastodon, or BlueSky (or Twitter X if you must).
Link to this page
Thanks for reading. I'd really appreciate it if you'd link to this page if you mention it in your newsletter or on your blog.