Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Save ugultopu/f5d25b31ffb992a064331f18bbd39457 to your computer and use it in GitHub Desktop.
Save ugultopu/f5d25b31ffb992a064331f18bbd39457 to your computer and use it in GitHub Desktop.

Use it as git log --graph --all --oneline.

This shows the abbreviated commit hash and the commit subject on one line, for every ref, in a graph format. The output is colored. Also, if there is a ref associated with a commit, that ref is printed as well.

To make the commit dates show as well, use it as git log --graph --all --pretty=format:"%C(auto)%h %cd%d %s" --date=short. Here, the pretty=format options and their meanings are as follows:

  • %C(auto): Use automatic coloring. Without this option, the whole output is just a single color.
  • %h: Print the abbreviated commit hash.
  • %cd: Print the committer date, which is the date of the commit. This option respects (honors) the value of the --date option.
  • %d: Print the ref name(s) associated with this commit. As far as I understand, d is a reference to the --decorate option of git-log. There is no space between %cd and %d because %d always has a leading space.
  • %s: Print the commit subject, which is the first line of the commit message.

The --date=short option makes the date (specified with %cd) to be expressed in YYYY-MM-DD format, instead of a more detailed format.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment