git log --pretty=format:"%h%x09%an%x09%ad%x09%s"

does the job. This outputs:

  fbc3503 mads    Thu Dec 4 07:43:27 2008 +0000   show mobile if phone is null...
  ec36490 jesper  Wed Nov 26 05:41:37 2008 +0000  Cleanup after [942]: Using timezon
  ae62afd tobias  Tue Nov 25 21:42:55 2008 +0000  Fixed #67 by adding time zone supp
  164be7e mads    Tue Nov 25 19:56:43 2008 +0000  fixed tests, and a 'unending appoi
  93f1526 jesper  Tue Nov 25 09:45:56 2008 +0000  adding time.ZONE.now as time zone
  2f0f8c1 tobias  Tue Nov 25 03:07:02 2008 +0000  Timezone configured in environment
  a33c1dc jesper  Tue Nov 25 01:26:18 2008 +0000  updated to most recent will_pagina

It was inspired by Stack Overflow question: "Git log output like 'svn ls -v'". I found out that I could add the exact parameters I needed.

To shorten the date (not showing the time), use --date=short.

In case you were curious what the different options were:

  • %h = abbreviated commit hash
  • %x09 = tab (character for code 9)
  • %an = author name
  • %ad = author date (format respects --date= option)
  • %s = subject

It is from git-log(1) Manual Page (PRETTY FORMATS section) by the comment of Vivek.

Answer from Jesper Rønn-Jensen on Stack Overflow
Top answer
1 of 16
1220
git log --pretty=format:"%h%x09%an%x09%ad%x09%s"

does the job. This outputs:

  fbc3503 mads    Thu Dec 4 07:43:27 2008 +0000   show mobile if phone is null...
  ec36490 jesper  Wed Nov 26 05:41:37 2008 +0000  Cleanup after [942]: Using timezon
  ae62afd tobias  Tue Nov 25 21:42:55 2008 +0000  Fixed #67 by adding time zone supp
  164be7e mads    Tue Nov 25 19:56:43 2008 +0000  fixed tests, and a 'unending appoi
  93f1526 jesper  Tue Nov 25 09:45:56 2008 +0000  adding time.ZONE.now as time zone
  2f0f8c1 tobias  Tue Nov 25 03:07:02 2008 +0000  Timezone configured in environment
  a33c1dc jesper  Tue Nov 25 01:26:18 2008 +0000  updated to most recent will_pagina

It was inspired by Stack Overflow question: "Git log output like 'svn ls -v'". I found out that I could add the exact parameters I needed.

To shorten the date (not showing the time), use --date=short.

In case you were curious what the different options were:

  • %h = abbreviated commit hash
  • %x09 = tab (character for code 9)
  • %an = author name
  • %ad = author date (format respects --date= option)
  • %s = subject

It is from git-log(1) Manual Page (PRETTY FORMATS section) by the comment of Vivek.

2 of 16
294

I use these two .gitconfig file settings:

[log]
  date = relative
[format]
  pretty = format:%h %Cblue%ad%Creset %ae %Cgreen%s%Creset

%ad is the author date, which can be overridden by --date or the option specified in the [log] stanza in .gitconfig. I like the relative date, because it gives an immediate feeling of when stuff was committed. The output looks like this:

6c3e1a2 2 hours ago [email protected] lsof is a dependency now.
0754f18 11 hours ago [email protected] Properly unmount, so detaching works.
336a3ac 13 hours ago [email protected] Show ami registration command if auto register fails
be2ad45 17 hours ago [email protected] Fixes #6. Sao Paolo region is included as well.
5aed68e 17 hours ago [email protected] Shorten while loops

This is all of course in color, so it is easy to distinguish the various parts of a log line. Also it is the default when typing git log because of the [format] section.

Since Git now supports padding, I have a nice amendment to the version above:

pretty = format:%C(yellow)%h %Cblue%>(12)%ad %Cgreen%<(7)%aN%Cred%d %Creset%s

This right aligns the relative dates and left aligns committer names, meaning you get a column-like look that is easy on the eyes.

Screenshot

Since GPG commit signing is becoming a thing, here is a version that includes signature verification (in the screenshot it's the magenta letter right after the commit). A short explanation of the flag:

%G?: show "G" for a good (valid) signature, "B" for a bad signature, "U" for a good signature with unknown validity and "N" for no signature

Other changes include:

  • colors are now removed if the output is to something other than the tty (which is useful for grepping, etc.)
  • git log -g now contains the reflog selector.
  • Save two parentheses on refnames and put them at the end (to preserve column alignment)
  • Truncate relative dates if they are too long (e.g., 3 years, 4..)
  • Truncate committer names (it might be a little short for some people, but just change the %<(7,trunc) or check out the Git .mailmap feature to shorten committer names)

Here's the configuration:

pretty = format:%C(auto,yellow)%h%C(auto,magenta)% G? %C(auto,blue)%>(12,trunc)%ad %C(auto,green)%<(7,trunc)%aN%C(auto,reset)%s%C(auto,red)% gD% D

All in all column alignment is now preserved a lot better at the expense of some (hopefully) useless characters.

I'd love to make the message color depend on whether a commit is signed, but it doesn't seem like that is possible at the moment.

Screenshot

🌐
Git
git-scm.com › docs › git-log
Git - git-log Documentation
This means that the final entry of a single-line format will be properly terminated with a new line, just as the "oneline" format does. For example: $ git log -2 --pretty=format:%h 4da45bef \ | perl -pe '$_ .= " -- NO NEWLINE\n" unless /\n/' 4da45be 7134973 -- NO NEWLINE $ git log -2 --pretty=tformat:%h 4da45bef \ | perl -pe '$_ .= " -- NO NEWLINE\n" unless /\n/' 4da45be 7134973
Discussions

gitconfig for "git log --oneline --decorate"
From the manpage : log.decorate=auto log.abbrevcommit=true format.pretty=oneline More on reddit.com
🌐 r/git
7
3
February 28, 2025
version control - How to output git log with the first line only? - Stack Overflow
I used git log --format="%h %B" -1, and then in javascript, I split on \n and take the first line (which still works even if there is no newline) 2020-09-17T18:41:17.173Z+00:00 ... This doesn't actually work, because (A. git aliases can't override built-in command names) and (B. There need to be quotes around "log --oneline... More on stackoverflow.com
🌐 stackoverflow.com
My favorite alias for git log
[alias] lg = log --graph --pretty=format:'%Cred%h%Creset -%C(yellow)%d%Creset %s %Cgreen(%cr)%Creset' --abbrev-commit --date=relative More on reddit.com
🌐 r/git
17
108
February 5, 2024
Trying to construct a very minimalistic `git log` based on tagged commits and branch names
What are you really trying to do? More on reddit.com
🌐 r/git
12
2
October 14, 2022
🌐
Git
git-scm.com › docs › pretty-formats
Git - pretty-formats Documentation
This means that the final entry of a single-line format will be properly terminated with a new line, just as the "oneline" format does. For example: $ git log -2 --pretty=format:%h 4da45bef \ | perl -pe '$_ .= " -- NO NEWLINE\n" unless /\n/' 4da45be 7134973 -- NO NEWLINE $ git log -2 --pretty=tformat:%h 4da45bef \ | perl -pe '$_ .= " -- NO NEWLINE\n" unless /\n/' 4da45be 7134973
🌐
Mackyle
mackyle.github.io › git-log-compact
git-log-compact – log --oneline with who & when
A compact alternative to git log --oneline that includes dates, times and author and/or committer initials in a space efficient output format.
🌐
ttias.be
ma.ttias.be › pretty-git-log-in-one-line
Pretty git log in one line
August 25, 2015 - $ git log --pretty=oneline 3396763626316124388f76be662bd941df591118 Add twitter link c73bbc98b5f55e5a4dbfee8e0297e4e1652a0687 add facebook link · It’s taking up less space, but missing crucial information like the date of the commit. There are longer versions of that same --pretty parameter. In fact, it allows you to specify all the fields you want in the output. $ git log --graph --pretty=format:'%Cred%h%Creset -%C(yellow)%d%Creset %s %Cgreen(%cr) %C(bold blue)<%an>%Creset' --abbrev-commit * 3396763 - (HEAD, origin/master, master) Add twitter link (4 days ago) <Mattias Geniar> * c73bbc9 - add facebook link (6 days ago) <Mattias Geniar> * cb555df - More random values (6 days ago) <Mattias Geniar> * 60e7bbf - Merge pull request #1 from TSchuermans/patch-1 (7 days ago) <Mattias Geniar> |\ | * 8044a8f - Typo fix (7 days ago) <Tom Schuermans> |/
🌐
Atlassian
atlassian.com › git › tutorials › git-log
Advanced Git Log | Atlassian Git Tutorial
January 12, 2026 - This can be combined with other configuration options. For example, running git log --oneline --decorate will format the commit history like so:
🌐
TheServerSide
theserverside.com › blog › Coffee-Talk-Java-News-Stories-and-Opinions › How-to-git-stash-untracked-files
git log oneline examples
The default git log command doesn’t provide the most visually pleasing results. The output is bulky and can make inspecting the commit history cumbersome. The solution? Use the –pretty=oneline switch whenever you need to view the git log.
Find elsewhere
🌐
Scaler
scaler.com › home › topics › git › git log --oneline
Git log --oneline - Scaler Topics
May 4, 2023 - The only issue with using the basic --graph option is that the wordiness of the log gets in the way. Hence, to fix that we can use this --graph option along with the --pretty oneline option in the git log command, in which the output will be in a much better format.
🌐
GitHub
gist.github.com › niun › ca61a37791ff1fdc9b33
git log graph --oneline with date and author and colored ref names as alias · GitHub
git log graph --oneline with date and author and colored ref names as alias - set-pretty-git-log-alias.sh
🌐
Devhints
devhints.io › git › git log format string cheatsheet
Git log format string cheatsheet
git log --pretty=format:%H · %H - Commit hash · %an - Author · � - Author date · One-page guide to Git log format string
🌐
Edureka
edureka.co › blog › git-format-commit-history
Git log format history | Use Git log to format the commit history | Edureka
September 14, 2024 - Draw a text-based graphical representation of the commit history before the sha-1 ids. Command: git log --graph Improved oneliner output: git log --graph --oneline
🌐
Jeff Kreeftmeijer
jeffkreeftmeijer.com › git-log-formats
Git log formats
July 17, 2021 - git log --format=oneline · a0806341633cc7f3b4a93c4cd6ff395ba904f873 Subject · git log --format=short · commit a0806341633cc7f3b4a93c4cd6ff395ba904f873 Author: Alice <alice@example.com> Subject · git log --format=full · commit a0806341633cc7f3b4a93c4cd6ff395ba904f873 Author: Alice <alice@example.com> Commit: Bob <bob@example.com> Subject First paragraph Second paragraph ·
🌐
CoreUI
coreui.io › answers › how-to-view-git-log-with-one-line
How to view Git log with one line · CoreUI
November 25, 2025 - Use git log --oneline to display commit history in a compact format with abbreviated hashes and concise commit messages.
🌐
GitHub
gist.github.com › mackyle › 4c33e4802a8269b3f200f2c00352ce6a
git-log-times a log --oneline alternative with dates, times and initials · GitHub
To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode characters ... An alterative to git log --oneline that includes dates, times and author initials in a compact one line output format.
🌐
Git
git-scm.com › book › en › v2 › Git-Basics-Viewing-the-Commit-History
2.3 Git Basics - Viewing the Commit History
In addition, the short, full, and fuller values show the output in roughly the same format but with less or more information, respectively: $ git log --pretty=oneline ca82a6dff817ec66f44342007202690a93763949 Change version number 085bb3bcb608e1e8451d4b2432f8ecbe6306e7e7 Remove unnecessary test a11bef06a3f659402fe7563abf99ad00de2209e6 Initial commit
🌐
Git Examples
gitexamples.com › examples › 66b65766-aaac-49c8-8004-3f839074b586
git log --oneline - Git Examples
This command displays a user-friendly ... includes the commit hash and the commit message. The --oneline flag truncates the usual multi-line commit log output to a simple one-liner....
🌐
w3tutorials
w3tutorials.net › blog › how-to-output-git-log-with-the-first-line-only
How to Show Git Log with Only the First Line of Commit Messages (One-Line Format) — w3tutorials.net
The --oneline flag is convenient, but you might want to add more context (e.g., author, timestamp) without losing brevity. Git’s --pretty=format: option lets you define a custom one-line format using format specifiers (placeholders for commit details)....
🌐
Gitimmersion
gitimmersion.com › lab_10.html
Lab 10 - Git Immersion
I like the one line format: ... $ git log --pretty=oneline e4e3645637546103e72f0deb9abdd22dd256601e Added a comment a6b268ebc6a47068474bd6dfb638eb06896a6057 Added a default value 174dfabb62e6588c0e3c40867295da073204eb01 Using ARGV f7c41d3ce80ca44e2c586434cbf90fea3a9009a5 First Commit