I'm having a strange issue, and I really can't tell whether it's caused by something related to my Git install or my shell, or something else entirely. If I'm in a Git repository with plenty of branches and commits, and I try to list branches:
$ git branch
$ git branch -a
$ git branch --list
There is no output at all. However, if I run the output of these commands through echo the results are as one might expect:
$ echo "`git branch`"
local-branch-1
local-branch-2
* master
$ echo "$(git branch -a)"
local-branch-1
local-branch-2
* master
remotes/origin/HEAD -> origin/master
remotes/origin/master
My configuration is macOS 10.14.6 with Git 2.29.2 installed via Homebrew. I'm using ZSH 5.8 (also Homebrew) with either Prezto or PowerLevel10k configurations. While these tools alias plenty of shortcuts to Git commands, nothing is aliased from git * that could be interfering:
$ type git
git is /usr/local/bin/git
git is /usr/bin/git
I've also tried a virgin Bash 5.0.18 shell, and the results are the same.
ZSH tab completion shows the branches correctly, so if I, for example:
$ git checkout <tab>
local-branch-1 master
local-branch-2 origin/HEAD
HEAD origin/master
I'm getting similar behavior from some other Git commands, for example git config --local --list. But all of the "action" commands (push, pull, add, commit, etc.) seem to work as intended, including the proper output. (But so do some "info-only" commands, like git version.)
This feels to me like some kind of shell configuration error, but it's only affecting Git as far as I can tell, and it happens in both my fancy ZSH installation and vanilla Bash, so maybe some weird interaction between the two? I've searched high and low for anyone else with a similar problem, but everything I've found boils down to branches not being listed on a fresh repository with no commits, which definitely isn't the case here.
I'm kind of out of ideas at this point, so I'm hoping someone has a suggestion for further investigation.