Some handy Git aliases


I got some useful Git aliases a while ago and was starting with a new client where I needed to recreate them so I decided the document them here.

git s is useful for short status display, defined like this:

git config --global alias.s 'status --short'

git lg is a short, graphical log display, defined like this:

git config --global alias.lg 'log --oneline --decorate --graph'

Example output is:

Git log output with --decorate

Then I decided to augment it with useful extra information, including colouring.

git config --global alias.lg 'log --graph --format="%C(auto)%h %C(cyan)%cn%C(auto)%d %s %C(magenta)%cr"'

Git log output with --format

The %C(auto) specification does not colour committer name or date, so I coloured those explicitly.

Documentation is here:

iCloud one-way synchronisation issue


I was finally able to resolve an iCloud synchronisation issue between my iPhone and Mac.

Calendar entries created on my Mac were immediately copied to my iPhone and iPad but entries created or edited on my iPhone were never synchronised back to the other devices. This was inconvenient because I carry my phone everywhere and needed events created there to be available on all my devices.

The solution was simple: sign out from iCloud on the phone and sign back in again.

Putting tags into HTML meta keywords


I wanted to include a page’s tags in an HTML meta tag as keywords.

Given a page with these tags:

I want the HTML header to contain:

<meta name="keywords" content="gradle,spring-boot"> 

I achieved that simply by adding this into the head.html include file:

  {% if page.tags %}
  <meta name="keywords" content="{{ page.tags | join: ',' }}">
  {% endif %}

Announcing blog posts on Twitter using IFTTT


When you have a blog you usually want to let your followers know when a new article is posted. This blog has an Atom feed but RSS readers are less common than they used to be and seem a bit old fashioned.

Announce on Twitter

Announcing a new blog post on my Twitter account seems like the modern way to go. But how?

A long-term solution will probably be to use a post-commit or post-push hook in GitHub where this blog is hosted.

Quick solution: IFTTT

I remembered that I have an account at If This Then That and decided to try using that. It is already linked to my Twitter account so that part of the process was ready to go. I created a new Applet (IFTTT-speak for a set of rules that link services together; formerly called a Recipe) to check the Atom feed periodically and tweet an announcement.

But IFTTT showed the Applet as never run and did not display any error messages that I could find.

Invalid Atom feed

IFTTT help pages include a link to the W3C Feed Validation Service. Using that showed the feed to be invalid because the email address field was empty. This was solved by adding to _config.yml. (I used a valid email address that I can get my mail provider to filter if it starts attracting spam.)

There were other, minor issues, including the link information showing instead of I don’t know why Jekyll does that, but a solution is to add an explicit url value to the configuration file:


(This value is only used in Jekyll production mode. In the default development mode it is overwritten by the actual URL: http://localhost:4000 by default.)


Update: The tweet for this page is:

Example tweet sent by IFTTT

By default, IFTTT uses its own link shortener, but I turned that off as described here.

Stopping code samples from wrapping


I needed to tweak the CSS for this blog so code samples do not wrap.

The goal

I wanted long lines like this one to not wrap, and be scrollable when they are too long:

    private static final Pattern REQUEST_PATTERN = Pattern.compile("^/v1/workflow/(?<crumbId>[0-9a-f]+)$");

They are converted by Jekyll into pre elements but the Poole and Lanyon styling causes them to wrap.

First solution

My blog stylesheet is read after those of Poole and Lanyon and contained:

pre {
  white-space: pre;
  overflow: auto;
  font-size: 0.7rem;
  • white-space: pre prevents word wrapping
  • overflow: auto causes too-long lines to be hidden instead of wrapped and scroll bars provided
  • font-size: 0.7em tweaks the font a bit to my liking

This worked in Chrome and Firefox but not in Safari, which was still wrapping code.

The Safari solution

I found that poole.css contains word-wrap: break-word in its pre rule. It appears that Safari places word-wrap at higher precedence than overflow.

So my blog stylesheet now includes this for code samples, and works in Safari as well:

pre {
  white-space: pre;
  overflow: auto;
  font-size: 0.7rem;
  word-wrap: unset;

NB: Is higher precedence the correct CSS term in this case? If you know, please let me know.