DEV Community

Cover image for Git log pretty print aliases
Austin Cunningham
Austin Cunningham

Posted on

Git log pretty print aliases

A couple of git aliases for git log pretty print. Add them to your .zshrc or .bashrc for usage and source the file e.g.source ~/.zshrc, or restart your terminal for the changes to apply.

gitp - pretty print the last 10 logs

#Print latest 10 submit logs
alias gitp="git log --pretty=format:'%C(yellow)%h %Cred%ad  %Creset%s' --date=local --max-count=10"
# Usage

Alt Text

gitpp - pretty print all logs

#Print latest all submit logs
alias gitpp="git log --pretty=format:'%C(yellow)%h %Cred%ad  %Creset%s' --date=local"

Output the same as gitp but not limited to 10 commits

gitpa - pretty print include author

# Include author
alias gitpa="git log --pretty=format:'%C(yellow)%h %<(24)%C(red)%ad %<(18)%C(green)%an %C(reset)%s' --date=local --max-count=10"
# Usage

Alt Text

gitag - pretty print tags

#Print log information on tags
alias gitag="git log --no-walk --tags --pretty=format:' %C(yellow)%h %Cgreen%d  %Cred%ad  %Creset%s' --date=local"
# Usage

Alt Text

gitbr - Provide minimal graphical display

#Provide minimal graphical display
alias gitbr='git log --oneline --decorate --graph --all'
# Usage

Alt Text

Used gitbr a lot in the passed but now use tig which does the same and more

Alt Text

Credit for these alias goes to

Discussion (0)