Search code examples
gitterminalgit-branchpager

Git branch command behaves like 'less'


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:

git branch paging output

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

My .gitconfig looks like this:

[user]
  email = [email protected]
  name = Dennis H.
[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

Solution

  • 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