git branch --list 'hotfix' returns a list of branches that contain the word 'hotfix' inside the branch name, whereas git for-each-ref --format='%(authorname)' 'hotfix' return nothing, not even /n symbol
git branch is looking (by default) at just the branches - the refs in refs/heads - so it lets you use patterns that match just the "branch name" (e.g. some-hotfix which is actually shorthand for the full ref name refs/heads/some-hotfix).
for-each-ref is looking at all refs, so it doesn't let you use such patterns.  You can use something like refs/heads/*hotfix* if you know that you're only interested in branches (or something like **/*hotfix* if not).
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With