Display git branches sorted by activity

Many times I have to check the branch I touched most recently. git-extras didn’t have a useful command to list the branches sorted by activity. I search around and found the following script that works perfectly.

## !/bin/sh

set -ex

git branch \
    -va \
    --sort=-committerdate \
    --format='%(committerdate:short) %(refname:short)'

The most updated version can be found here https://raw.githubusercontent.com/dilawar/Scripts/master/git_branch_sorted_by_activity.sh.

Leave a Reply