Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
git "smartlog" / "pretty log"
# blog post
#
# https://www.jessesquires.com/blog/customizing-git-log/
git log --graph --pretty=format:'commit: %C(bold red)%h%Creset %C(red)<%H>%Creset %C(bold magenta)%d %Creset%ndate: %C(bold yellow)%cd %Creset%C(yellow)%cr%Creset%nauthor: %C(bold blue)%an%Creset %C(blue)<%ae>%Creset%n%C(cyan)%s%n%Creset'
@jessesquires

This comment has been minimized.

Copy link
Owner Author

@jessesquires jessesquires commented Jul 30, 2017

Blog post:
https://www.jessesquires.com/blog/customizing-git-log/

Set the alias in git:

$ git config --global alias.smartlog "log --graph --pretty=format:'commit: %C(bold red)%h%Creset %C(red)<%H>%Creset %C(bold magenta)%d %Creset%ndate: %C(bold yellow)%cd %Creset%C(yellow)%cr%Creset%nauthor: %C(bold blue)%an%Creset %C(blue)<%ae>%Creset%n%C(cyan)%s%n%Creset'"

$ git config --global alias.sl '!git smartlog'

Usage:

# can use 'git smartlog' or the shorter 'git sl'
$ git sl
@aregler

This comment has been minimized.

Copy link

@aregler aregler commented Jul 31, 2017

Awesome. Thank you!

@orta

This comment has been minimized.

Copy link

@orta orta commented Jul 31, 2017

Screenshot for those interested

screen shot 2017-07-31 at 12 01 19

@algal

This comment has been minimized.

Copy link

@algal algal commented Jul 31, 2017

It's beautiful!

FWIW, I've been living off this one for a while, which I think I got on SO:

git config --global alias.lg "log --graph --pretty=format:'%Cred%h%Creset -%Cblue%d%Creset %s %Cgreen(%cr)%Creset' --abbrev-commit --date=relative"

It's one line per commit, with tags, commuter name, graph structure, and colorization.

@muffins

This comment has been minimized.

Copy link

@muffins muffins commented Mar 4, 2019

Thank you <3

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.