30

Before git version 2.17.1 (no more than 4 versions back), when you ran

git branch

you would get an inline list of branches and your terminal was ready for a new command.

In version 2.17.1 you get a list of branches as a new screen, and have to press q to quit it. After you quit, you no longer see your branches.

Without downgrading, how can I list branches inline as before?

Boris Yakubchik
  • 3,861
  • 3
  • 34
  • 41
  • 1
    See https://stackoverflow.com/a/8883248/3906760 – MrTux Jun 08 '18 at 15:03
  • 4
    Possible duplicate of [git-branch command behaves like less](https://stackoverflow.com/questions/48341920/git-branch-command-behaves-like-less) – phd Jun 08 '18 at 16:13

2 Answers2

64

The config setting pager.<cmd> works for me:

git config --global pager.branch 'false'

Before running that command, git branch used a pager. After that command, git branch printed the list of branches directly to the terminal.

Rory O'Kane
  • 29,210
  • 11
  • 96
  • 131
  • Thanks for finding this, I was worried I'd have to start typing `git branch | cat` from now on but a quick search led me to this simple answer! – ThinkBonobo Feb 04 '22 at 17:21
8

You can force the desired behavior with the --no-pager flag

git --no-pager branch

or edit .gitconfig to include this

[pager]
    branch = false

which will disable the new behavior

Boris Yakubchik
  • 3,861
  • 3
  • 34
  • 41