You can simply use the command
git branch -r | wc -l
wc -l counts the number of branches. But what if you want to know the count of branches which are older and unmodified from long period of time. You can use
git for-each-ref --sort=committerdate refs/heads/ --format='%(refname:short) %(committerdate:relative)' | awk '$2 ~ /ago/ {print $1}' | wc -l
This command uses 'awk' to filter branches with a commit date containing "ago" (indicating they are older than 30 days) and then pipes the result to wc -l to count the number of matching branches.
git for-each-ref --sort=committerdate refs/heads/ --format='%(refname:short) %(committerdate:relative)' | awk '$2 ~ /months/ || $2 ~ /year/ {print $1}' | wc -l
This is to get the count of branch older than 60 days likely having a commit date string containing "months" or "year."
Feel free to adjust the conditions in the 'awk' command based on your specific needs or the format of the date strings in your Git repository.
(git branch -r).Count. In Powershell v7.1 you also have the Mesure-Object command for detail/control.