git for-each-ref --sort=-committerdate --format='%(committerdate:short) %(refname:short)' refs/heads/
Explanation:
git for-each-ref
: Iterates over refs (branches, tags, etc.).--sort=-committerdate
: Sorts by the last commit date in descending order (newest first).--format='%(committerdate:short) %(refname:short)'
: Formats the output to show the commit date and branch name.refs/heads/
: Limits the output to local branches.