git recent

recent branches

I came across1 a useful git alias that lists the 10 most recent branches:

git config --global alias.recent-branches '!git branch --sort=-committerdate --format="%(committerdate:relative)%09%(refname:short)" | head -10'

Which can be called using git recent-branches.

recent commits

This inspired me to make a similar alias to list the 10 most recent commits:

git config --global alias.recent-commits '!git log --pretty=format:"%ar %x09 %Creset %h %x09 %s <%an>" -n 10 --no-merges --no-decorate'

Which can be called using git recent-commits.

recent changes

Which then inspired me to make an alias to list a graph of the 10 most recent commits:

git config --global alias.recent '!git log --branches --remotes --tags --color=always --all -n 10 --format="%C(auto)%h %C(bold red)(%S)%Creset %Cgreen%ar%Creset %s %C(bold blue)<%an>%Creset" --graph --decorate'

Which can be called using git recent.


  1. https://bernsteinbear.com/git/