gitgit-logpager

Why does git log doesn't show HEAD and branches when passed to a pager


When passed to a pager (git log | less, watch git log, etc), the (HEAD -> master, origin/master, origin/HEAD) doesn't show up.


Solution

  • It's called ref names. It doesn't show up because if we don't specify --decorate, git log will use --decorate=auto by default.

    From the docs:

    If auto is specified, then if the output is going to a terminal, the ref names are shown as if short were given, otherwise no ref names are shown. The option --decorate is short-hand for --decorate=short. Default to configuration value of log.decorate if configured, otherwise, auto.