Reputation: 3995
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.
Upvotes: 1
Views: 137
Reputation: 3995
The two following commands provides almost what I want:
id = log -1 --pretty=format:'%h%d'
id = show -s --pretty=format:'%h%d'
With the ability to give a ref as parameter, for instance:
$ git id 5.6.0
02a719d (some-tag, origin/master, origin/5.6.0, master, feature-NXP-9342-make_wizard_use_connect_client, 5.6.0)
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.g HEAD@{4}
).
For instance, in the above sample, some-tag
would be yellow (color for tags), origin/master
and origin/5.6.0
would be blue (color for remote branches), feature-NXP-9342-make_wizard_use_connect_client
and 5.6.0
would be green (color for branches) and master
would be orange (color for the current HEAD). Any hints?
Upvotes: 1