Update
So I was wrong, --format
can be used with the --abbrev-commit
and --date=relative
flags, so the problem was strictly the existence of \n
in your command. The flags are still unnecessary, however, because their place holders are already in your command, as I've explained below.
It appears that the --format
option is not compatible with the --abbrev-commit
and --date=relative
options. If you remove them, you'll get what you want. You also have \n
in your command that's not a part of the format, nor are they a legal arguments to the command, so those should be removed too:
hist = log --all --graph --pretty=format:'%Cred%h%Creset %ad -%C(yellow)%d%Creset %s %Cgreen(%cr) %C(bold blue)<%an>%Creset'
In addition, the --abbrev-commit
and --date=relative
flags are unnecessary, since %h
already gives you abbreviated-commits, %ad
automatically defaults to the user's local time (if they haven't set their log.date
config variable), and %cr
displays the date in relative time (e.g. "7 days ago").
From the official Kernel Git documentation for git log
:
log.date
config variable sets a default value for log command’s --date
option.
--date=default
shows timestamps in the original timezone (either committer’s or author’s).
%h
: abbreviated commit hash
%ad
: author date (format respects --date=
option)
%cr
: committer date, relative