GitHub is an awesome code repository and code distribution website. It’s used by countless people and organizations to develop and release code.
I’ve wanted to made use of GitHub for a very long time now but the site is built around the Git revision control software. However I instead extensively use Subversion (SVN) in my daily life and have no desire or need to learn Git — everything I currently do requires that I use SVN. Not to mention that the Git experience on Windows is absolutely horrendous.
So I was incredibly pleased to learn that GitHub supports SVN! They added full support way back in October 2011 but I somehow missed the memo.
This is super good news because it means I can now start to distribute my code and projects via my my GitHub page. Nothing is there quite yet but I hope to package up and commit some code to there soon.
The other day I wanted to figure out when a particular line in WordPress was changed. I wanted to know this so I could find the commit message and ticket that went along with it so I could figure out the reasoning behind the change. How do you go about doing that though?
It turns out that svn blame is the command you want. It will output something like this:
$ svn blame http://svn.red-bean.com/repos/test/readme.txt
3 sally This is a README file.
5 harry You should read this.
So the first line was last modified by sally in revision 3 and the second line was last modified by harry in revision 5. Awesome huh?
Props to @ArtemR, @westi, and @zamoose for informing my noob ass on how to do this!
Zialus asked me to explain how I keep my blog’s theme up to date using SVN while keeping my modifications. The answer is too long for Twitter, so I’m writing a small blog post about it.
- I checked out a copy of the theme I use to my computer (easier to work on it from my PC than my server). The SVN URL for themes hosted on WordPress.org is
http://themes.svn.wordpress.org/. Find your theme there. For example my blog’s theme is
http://themes.svn.wordpress.org/mystique/1.72/ (as of the time of this post).
- I made the changes I wanted to the theme on my computer (tweaks and such) and then uploaded it to my server.
- When a new version of the theme is released, I run
svn diff > file.diff on my local checkout to get a file containing all of my modifications (this will be handy for the next step).
- I use
svn switch to switch to the new version SVN URL. Your SVN client will attempt to merge in any changes by the theme author into your modified files, but it may run into collisions (where the theme’s author and you have modified the same area of a file). You’ll need to manually fix any collisions (this is why I check out to my PC instead of my server). I tend to just hit revert on the file and then using the diff file from the previous step for reference, re-add my modifcations.
- Upload the new version of the theme (with your modifications to your server).
Questions? Feel free to ask via my comments section.