Git branch command behaves like 'less'

DenniJensen picture DenniJensen · Jan 19, 2018 · Viewed 40.9k times · Source

When I use the git branch command to list all branches, I see the output of git branch | less.

The command git branch is supposed to show a list of branches, like ls does for files.

This is the output I get:

Enter image description here

How do I get the default behaviour of git branch? What causes the paged output?

I am using ZSH with oh_my_zsh (nothing for Git in there), and my .gitconfig looks like this:

[user]
  email = [email protected]
  name = Dennis Haegler
[push]
  default = simple
[merge]
   tool = vimdiff
[core]
  editor = nvim
  excludesfile = /Users/dennish/.gitignore_global
[color]
  ui = true
[alias]
  br = branch
  ci = commit -v
  cam = commit -am
  co = checkout
  df = diff
  st = status
  sa = stash
  mt = mergetool
  cp = cherry-pick
  pl = pull --rebase
[difftool "sourcetree"]
  cmd = opendiff \"$LOCAL\" \"$REMOTE\"
[mergetool "sourcetree"]
  cmd = /Applications/SourceTree.app/Contents/Resources/opendiff-w.sh 
  \"$LOCAL\" \"$REMOTE\" -ancestor \"$BASE\" -merge \"$MERGED\"
  trustExitCode = true

Answer

Zach Schneider picture Zach Schneider · Jan 21, 2018

As mentioned in comments to Mark Adelsberger's answer, this was a default behavior change introduced in Git 2.16.

You can turn paged output for git branch back off by default with the pager.branch config setting:

git config --global pager.branch false