shapeNoteStyles property can be used to set custom note head styles for each step of the scale (as set by the key signature or the "tonic" property). The note head style you designate for G will also be used for G# and Gb, as in shape note notation.
The method used in this snippet lets you assign custom note heads based on a note's pitch or full name. This allows you to assign different note heads for naturals, sharps, and flats, for example. In this snippet sharp and flat notes are given a square note head shape. [This is based on the snippet "Coloring notes depending on their pitch".]