The shortest possible output from git log containing author and date

Viewed 262781

How can I show a git log output with (at least) this information:

* author
* commit date
* change

I want it compressed to one line per log entry. What's the shortest possible format for that?

(tried --format=oneline but that does not show the date)

16 Answers

enter image description here
The -10 at the end is to show the last 10 commits.

Use predefined git alias (hs - short for history):

git hs

Created once by command:

git config --global alias.hs "log --pretty='%C(yellow)%h %C(cyan)%cd %Cblue%aN%C(auto)%d %Creset%s' --graph --date=relative --date-order"

%h = abbreviated commit hash
%cd = committer date (format respects --date= option)
%aN = author name (respects .mailmap)
%d = ref names
%s = subject

P.S. Since Git v2.13.0, --decorate is enabled by default.

References:

git --no-pager log --pretty=tformat:"%C(yellow)%h %C(cyan)%ad %Cblue%an%C(auto)%d %Creset%s" --graph --date=format:"%Y-%m-%d %H:%M" -25 

I use alias

alias gitlog='git --no-pager log --pretty=tformat:"%C(yellow)%h %C(cyan)%ad %Cblue%an%C(auto)%d %Creset%s" --graph --date=format:"%Y-%m-%d %H:%M" -25'

Differences: I use tformat and isodate without seconds and time zones , with --no-pager you will see colors

Try git log --pretty=fuller, it will show you:- Author: Author Date: Commit: Commit Date:

Hope this helps.

Run this in project folder:

$ git log --pretty=format:"%C(yellow)%h %ar %C(auto)%d %Creset %s , %Cblue%cn" --graph --all

And if you like, add this line to your ~/.gitconfig:

[alias]
    ...
    list = log --pretty=format:\"%C(yellow)%h %ar %C(auto)%d %Creset %s, %Cblue%cn\" --graph --all

If you wanna specify a file or folder, just add the path at the end:

  • %ad = author date (format respects --date=option)
  • --date=raw shows the date as seconds since the epoch (1970-01-01 00:00:00 UTC), followed by a space, and then the timezone as an offset from UTC Reference
git log -1 --pretty=format:"%ad" --date=raw path/to/your/folder

looks like this is what you are after:

git log --pretty=" %C(reset)%ad %C(Cyan)%an: %C(reset)%s"

(in personal note you should always has commit hash..)

Related