how to sort git branch by name 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: recent branches
git branch --sort=-committerdate // Descending order