Git 分支命令的行为类似于“少" [英] Git branch command behaves like 'less'

查看:38
本文介绍了Git 分支命令的行为类似于“少"的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

当我使用git branch 命令列出所有分支时,我看到git branch | 的输出少.

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

命令 git branch 应该显示一个分支列表,就像 ls 对文件所做的一样.

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

这是我得到的输出:

如何获得 git branch 的默认行为?分页输出的原因是什么?

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

我正在使用带有 oh_my_zsh 的 ZSH(里面没有 Git),我的 .gitconfig 看起来像这样:

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

[user]
  email = myemail@mail.com
  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

推荐答案

对 Mark Adelsberger 的回答的评论,这是默认行为更改 在 Git 2.16 中引入.

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

您可以使用 pager.branch 配置设置:

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

git config --global pager.branch false

这篇关于Git 分支命令的行为类似于“少"的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆