--date=(relative|local|default|iso|rfc|short|raw) Only takes effect for dates shown in human-readable format, such as when using "--pretty". log.date config variable sets a default value for log command’s --date option. --date=relative shows dates relative to the current time, e.g. "2 hours ago". --date=local shows timestamps in user’s local timezone. --date=iso (or --date=iso8601) shows timestamps in ISO 8601 format. --date=rfc (or --date=rfc2822) shows timestamps in RFC 2822 format, often found in E-mail messages. --date=short shows only date but not time, in YYYY-MM-DD format. --date=raw shows the date in the internal raw git format %s %z format. --date=default shows timestamps in the original timezone (either committer’s or author’s).
.gitconfig中天上下面这样, 就很好了
git config --global pretty=xxxxx
git config --global log.date=xxxxx
[format] pretty = " %Cred%h %Cgreen(%ad) %C(bold blue)<%an> %Creset%d %s " [log] date = iso8601
达到的效果就是:
git log --pretty=format:' %Cred%h %Cgreen(%ad) %C(bold blue)<%an> %Creset%d %s ' --date=format:'%Y-%m-%d %H:%M:%S' -n 100
的效果.
设置了全局之后, git log就按照上面的好看的格式出来了.