DEV Community

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

Posted on

2 1

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
gitp
Enter fullscreen mode Exit fullscreen mode

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"
#Usage
gitpp
Enter fullscreen mode Exit fullscreen mode

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
gitpa
Enter fullscreen mode Exit fullscreen mode

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
gitag
Enter fullscreen mode Exit fullscreen mode

Alt Text

gitbr - Provide minimal graphical display

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

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 https://github.com/usplitu

Postmark Image

Speedy emails, satisfied customers

Are delayed transactional emails costing you user satisfaction? Postmark delivers your emails almost instantly, keeping your customers happy and connected.

Sign up

Top comments (0)

A Workflow Copilot. Tailored to You.

Pieces.app image

Our desktop app, with its intelligent copilot, streamlines coding by generating snippets, extracting code from screenshots, and accelerating problem-solving.

Read the docs

👋 Kindness is contagious

Please leave a ❤️ or a friendly comment on this post if you found it helpful!

Okay