git log –all

Despite git’s power, it can be very un-intuitive.

E.g. you run git log expecting to see all log messages. Not true. You have to run git log –all to see all of them (* see Note 1 below).

And the output is not obvious. e.g.

commit c751111
Merge: fc07fdf 4059fc6
Author: <author>
Date:   Mon Apr 20 14:42:08 2015 -0400

WIP on dev/app/admin/categories: fc07fdf with auto categories

commit 4059fc6
Author: <author>
Date:   Mon Apr 20 14:42:08 2015 -0400

index on dev/app/admin/categories: fc07fdf with auto categories

commit fc07fdf
Author: <author>
Date:   Mon Apr 20 14:39:01 2015 -0400

with auto categories

Let’s go through each line:

1: shows the SHA-1 reference of that commit

2: it seems to have been a merge between 2 other commits

3: author details

4: date

5: this is an auto-generated stash message. <WIP => work in progress> on <name of branch>: <commit SHA-1 reference> <commit message>

The next line of interest is

index on dev/app/admin

Presumably this was auto-generated by git. I don’t have a clue there.


Note 1: another example of the unintuitiveness of git. It turns out that git log –all does NOT show all the log messages. Here’s what it actually does:

warning: push.default is unset; its implicit value has changed in Git 2.0 from ‘matching’ to ‘simple’.

I recently tried pushing a new branch and got this:

Just enter this to change the setting:

More here:

Mac as a Development platform

I sometimes feel as if I spend half my time making fixes caused by Apple upgrades.

This morning I found my previously hand-crafted php.ini had been removed.

So, each time Apple does an upgrade I have to go back in and update php.ini with various customizations (like max post size, etc).

This also happened to Apache. Apple did an upgrade and I lost my virtualhosts.

And other things change too – like I now have to use mysql.server start rather than using mysqld. I can understand that things need to change but why not provide a graphic tool and just change things under the hood.

Now I try restarting MySQL and I get:

So clearly another update has happened that I’ll need to fix.

My experience on Linux has always been much smoother. I’m starting to wonder if I should try using it again as a development platform.

How does WordPress load templates?

The short answer:

– go see

However, here’s a worked-out example.

I have a page called News with the slug “news”.  Here’s how WordPress loads the necessary page:

1. Apache runs your root /index.php file

2. This require’s

3. wp-blog-header then:

require_once’s wp-load.php

runs wp() and

require_once’s template-loader.php

4. template-loader.php does a few checks and then runs a huge if, elseif:


It turns out that the example given sets $template to ‘wp-content/themes/<theme name>/page-news.php’.

How does it do that? Well, if we search for the function get_page_templates() it turns out there are 3 occurrences in the WordPress code (in wp-admin/includes/theme.php and in various wp-includes files – class-wp-theme.php, template.php).

So, which one is it using?

The answer:

wp-includes/template.php which returns the value here:

Where is get_page_template_slug() defined?

In wp-includes/post-template.php. This works out the post using the post_id.

Then it works out the template using get_post_meta() (which is defined in post.php).

get_post_meta simply returns the result of another function get_metadata which is defined in meta.php.

The full code:

In meta.php > get_metadata it checks $meta_key. It cycles through a bunch of values in $meta_cache until it gets to $meta_key = ‘_wp_mf_page_template’.

The code:

cycles through the $meta_cache values just to decide the template! I had 343 values!

I literally gave up here as, whilst I spotted a $meta_key = “_wp_page_template” it continued to cycle through the $meta_cache values. Without wasting more time on this I can only assume it found the value here.





Google Contacts – I can’t find any of my Contacts any more

I have all my contacts in Google Contacts.

If I want to find someone I usually type their name in the Google Contacts search box and I can find them in seconds.

This has all changed now.

The latest version of Google Contacts now searches Google+. E.g. take a look at this:

Google Contacts 588w, 622w" sizes="(max-width: 300px) 100vw, 300px" />

Here’s a search I did recently for someone called Mark.

Why does Google think it makes any sense whatsoever to search all the Marks in the entire world?

I’ve tried clicking all the menu options at the top and on the left such as “Frequently contacted”, etc.

I have literally no idea how to search my Contacts any more. Fortunately, I have my contacts synced with my iPhone and now do all my searches using the Contact app there.