Skip to content

Instantly share code, notes, and snippets.

@jessesquires
Last active December 3, 2023 07:08
Show Gist options
  • Star 30 You must be signed in to star a gist
  • Fork 2 You must be signed in to fork a gist
  • Save jessesquires/d0f3fc99be8208394a450ce86443ce7d to your computer and use it in GitHub Desktop.
Save jessesquires/d0f3fc99be8208394a450ce86443ce7d to your computer and use it in GitHub Desktop.
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
Copy link
Author

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
Copy link

aregler commented Jul 31, 2017

Awesome. Thank you!

@orta
Copy link

orta commented Jul 31, 2017

Screenshot for those interested

screen shot 2017-07-31 at 12 01 19

@algal
Copy link

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
Copy link

muffins commented Mar 4, 2019

Thank you <3

@jd-nuva
Copy link

jd-nuva commented Dec 3, 2023

thanks and this is what I search for every time i setup a new devserver

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