I would like to set an alias for getting the ref names pointing at the current changeset (HEAD) or a given ref. The aim is to know “where are we?”, “which branches and tags are equivalent (pointing at the same ref)?”, “what is the current ref?”, “where is the given ref compared to HEAD?”.
Some of these informations are available using various Git commands and shown in most Git prompts.
I would like to set an alias for getting the ref names pointing at
Share
The two following commands provides almost what I want:
With the ability to give a ref as parameter, for instance:
Ideally, I would like to add some colors to differently highlight the current checkout ref (
.git/HEAD), the tags and the local and remote branches. The reflog could be useful too (e.gHEAD@{4}).For instance, in the above sample,
some-tagwould be yellow (color for tags),origin/masterandorigin/5.6.0would be blue (color for remote branches),feature-NXP-9342-make_wizard_use_connect_clientand5.6.0would be green (color for branches) andmasterwould be orange (color for the current HEAD). Any hints?