When passed to a pager (git log | less
, watch git log
, etc), the (HEAD -> master, origin/master, origin/HEAD)
doesn't show up.
Why does git log doesn't show HEAD and branches when passed to a pager
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.
If you also want color, you can use
--color=always
or --color
, e.g. git log --decorate --color | less -R
or watch -c 'git log --decorate --color'
–
Samsun © 2022 - 2024 — McMap. All rights reserved.
git log
will run the pager for you automatically by default, under various conditions. Seepager.log
,core.pager
, and other Git settings. (This is described in thegit config
documentation, which is very long and generally requires a lot of searching.) – Catarina