如何让git diff写入标准输出? [英] How to make git diff write to stdout?

查看:330
本文介绍了如何让git diff写入标准输出?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

默认情况下, git diff 会在stdout中打印所有的 + - 行,但我有一个(devian)机器我通过ssh连接)其中 git diff 导致我到一个编辑器(我不知道是哪个编辑器),我需要按 q 继续。

By default git diff prints all +- lines to the stdout however I have a (devian) machine (which I connect through ssh) where git diff leads me to an editor (which I don't know which is) and I need to press q to continue.

我有checker git config,它看起来像:

I've checker git config and it looks like :

$ git config --list
user.name=XXX
user.email=XXX@XXX
color.ui=false
difftool.prompt=false
mergetool.prompt=false
core.repositoryformatversion=0
core.filemode=true
core.bare=false
core.logallrefupdates=true
remote.origin.fetch=+refs/heads/*:refs/remotes/origin/*
remote.origin.url=XXX
branch.master.remote=origin
branch.master.merge=refs/heads/master
$ git config --global --list
user.name=XXX
user.email=XXX@XXX
color.ui=false
difftool.prompt=false
mergetool.prompt=false
$ git config --system --list
'/etc/gitconfig': No such file or directory

有没有我失踪的地方?也许这个未知的工具是回退或者是因为我的机器丢失了一些东西?任何帮助表示赞赏。感谢。

Is there a place I am missing? Maybe the unknown tool is a fallback or something because I my machine is missing something? Any help is appreciated. Thanks.

推荐答案

默认情况下,Git会将它的差异输出(通常是任何可能超过屏幕效果的输出)系统的 pager ,它是一次只能打印一个屏幕输出的实用程序。如果您想在运行命令时禁用寻呼机,请将 - no-pager 传递给Git:

By default, Git sends its diff output (and generally any output that may be more than a screenful) to the system's pager, which is a utility that prints only one screenful of output at a time. If you want to disable the pager when you run a command, pass --no-pager to Git:

$ git --no-pager <subcommand> <options>

这可以针对任何Git命令运行。

This can be run for any Git command.

如果您想要默认禁用 for diff only ,您可以通过运行以下命令将diff pager设置为 cat

If you want to disable it by default for diff only, you can set the diff pager to cat by running:

$ git config pager.diff false

如果您想为所有命令默认禁用 ,您可以通过运行以下命令将Git分页器设置为 cat / p>

If you want to disable it by default for all commands, you can set the Git pager to cat by running:

$ git config --global core.pager cat

这篇关于如何让git diff写入标准输出?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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