git list latest branches code example
Example 1: view git branches most recent first
git for-each-ref --sort=-committerdate refs/heads/
# Or using git branch (since version 2.7.0)
git branch --sort=-committerdate # DESC
git branch --sort=committerdate # ASC
Example 2: how to see all branches in git
git branch -a