Sort git branches

Published on 06/27/2024

Often I have to move between different branches in my daily work and I always have a hard time remembering the name of last branches which I am working on.

A mental noise I avoid gladly.

I discovered that it is possible to sort the list of branches by some criteria, and the most interesting for my case is by commit date.

This is the command to set it in the git configuration.

git config --global branch.sort -committerdate
  • Article is published under CC-BY 4.0
  • If not explicitly declared code snippets are published under MIT license