git 如何在 Diff 的结果中导航

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/8640838/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me): StackOverFlow

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-09-10 12:35:50  来源:igfitidea点击:

How do I navigate in the results of Diff

git

提问by Barka

When I do a Git diff, it shows the code with the diff and it looks great. But how do I go to the next page or the next document.

当我做一个 Git diff 时,它显示了带有 diff 的代码,看起来很棒。但是我如何转到下一页或下一个文档。

回答by wadesworld

Next line             : return
Next page             : space bar
Previous page         : w
Quit viewing the diff : q
Help                  : h

回答by holygeek

Hit ?and it should show you the command shortcuts for doing page up/page down etc.

点击?它,它应该会显示用于向上翻页/向下翻页等的命令快捷方式。

By default gitlooks at the $GIT_PAGER, then $PAGERenvironment variable to determine the program to be used for showing you the output of diff, log, show etc.

默认情况下,git查看$GIT_PAGER, then$PAGER环境变量以确定用于向您显示 diff、log、show 等输出的程序。

On new (linux) systems the default $PAGERused (even when it is not set) is less(it used to be the less capable more).

在新的 (linux) 系统上,$PAGER使用的默认值(即使未设置)是less(它曾经是能力较差的more)。

In both lessand morethe ?key gives you a command shortcut list.

在这两个lessmore?钥匙给你一个命令快捷键列表。

回答by Harsh Shah

For scrolling downwards Usej or ↓ to move down one line at a time d to move by half the page screen f to move by a whole page screen

向下滚动 使用j 或 ↓ 一次向下移动一行 d 移动页面屏幕的一半 f 移动整个页面屏幕

For scrolling upwards usek or ↑ to move up one line at a time u to move by half the page screen b to move by a whole page screen

对于向上滚动,使用k 或 ↑ 一次向上移动一行 u 移动页面屏幕的一半 b 移动整个页面屏幕

press qto quit out of the log It will returns to the regular command prompt

q退出日志它将返回到常规命令提示符

回答by Michael Durrant

Also, consider installing gitx(Mac) or gitg(Ubuntu) for wonderful (and easy) gui options :)

另外,考虑安装gitx(Mac) 或gitg(Ubuntu) 以获得美妙(且简单)的 gui 选项:)

回答by Spike0xff

I'm running what I think is a stock git install on Windows, msysgit 1.8.3, and for me git diff runs something that claims to be less, version 444. Instead of '?' for help, it wants 'h'. Seems that '?' is the start of some kind of regular expression search.

我正在运行我认为是 Windows 上的股票 git 安装,msysgit 1.8.3,对我来说,git diff 运行一些声称更少的东西,版本 444。而不是 '?' 寻求帮助,它需要'h'。似乎是“?” 是某种正则表达式搜索的开始。