Comment

Peter Bengtsson

Actually, `git branch --all --merged <default>` lists all the remote branches too. So it's not any faster than `git branch --all --merged`.

Parent comment

JohnClark

Nice win moving everything into Promise.all — that’s the obvious first big gain. At least now you’re paying the 500ms once instead of stacking multiple Git calls back to back. If getAllMergedBranches is still the bottleneck, I’d look at narrowing scope. git branch --all --merged is expensive because it walks history and includes remotes. If you only care about branches merged into the default branch, try git branch --merged and maybe drop --all unless you truly need remote refs. Another option is caching. Merged status doesn’t change that often relative to local commands. Even a short-lived in-memory cache per run could help. Half a second isn’t terrible, but for a CLI it’s noticeable. Reducing ref scope is probably your biggest lever now.