How to list all branches from a Git repo into the own console

Everytime I run git branch -a, an editor (I suppose nano) is opened to show the output, but I wish the output is by using the same console (like cat). How do I get it?

My info:

  • OS: Manjaro Linux x86_64
  • Kernel: 5.12.9-1-MANJARO
  • Shell: zsh 5.8
  • Git: 2.32.0

Answer

It seems it’s the "pager" of Git that shows up here (if you have many branches).

You can try if one of these works for you (see the doc of git config):

  • git --no-pager branch -a
  • GIT_PAGER=cat git branch -a
  • git config --global pager.branch false or more aggressively git config --global core.pager cat; then git branch -a

FTR, the “pager” that is triggered in practice is normally less (not nano): see this other section of git config‘s doc.