I have not played in vanilla UI in a decade, so I do not remember which ways are Vanilla vs Pinco's UI. If you are playing in EC, Pincos triples the capabilities and QOL, so no reason not to install it.
The simplest way is to put the GH button on a toolbar, right click on it, select "Target", pick "Stored", and designate your pet as a stored target. From then on, clicking on this button or pressing the key combination (if you chose to assign it) will heal that particular pet.
If you want to have a more universal macro, you can make something like this:
1 greater heal
2 target pet*
3 wait for target
4 target current
*Under Pinco, you have several options as far as targeting. You can use "Target nearest follower", or, especially useful if you play with packs, you can use "Target severely injured follower". The last one will heal the most damaged pet.