如何在长行中使用git diff? [英] How should I use git diff for long lines?

查看:103
本文介绍了如何在长行中使用git diff?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在文件上运行 git-diff ,但是更改了在长行的末尾。

I'm running git-diff on a file, but the change is at the end of a long line.

如果我使用光标键向右移动,则会丢失颜色编码—更糟糕的是,行无法对齐

If I use cursor keys to move right, it loses colour-coding—and worse the lines don't line up—making it harder to track the change.

有没有办法防止该问题或只是简单地使行换行?

Is there a way to prevent that problem or to simply make the lines wrap instead?

我正在通过mingw32运行Git 1.5.5。

I'm running Git 1.5.5 via mingw32.

推荐答案

<$ c $的输出显示c> git diff 由您使用的任何传呼机处理。

The display of the output of git diff is handled by whatever pager you are using.

在Linux下,普通的 less

Commonly, under Linux, less would be used.

您可以通过设置 GIT_PAGER 环境来告诉git使用其他寻呼机变量。如果您不介意分页(例如,您的终端允许您向后滚动),则可以尝试将 GIT_PAGER 显式设置为空,以使用寻呼机将其停止。在Linux下:

You can tell git to use a different pager by setting the GIT_PAGER environment variable. If you don't mind about paging (for example, your terminal allows you to scroll back) you might try explicitly setting GIT_PAGER to empty to stop it using a pager. Under Linux:

$ GIT_PAGER='' git diff

没有寻呼机,行将自动换行。

Without a pager, the lines will wrap.

如果您的终端没有支持彩色输出,您也可以使用-no-color 参数将其关闭,或在git配置文件的color部分中放置一个条目。

If your terminal doesn't support coloured output, you can also turn this off using either the --no-color argument, or putting an entry in the color section of your git config file.

$ GIT_PAGER='' git diff --no-color

这篇关于如何在长行中使用git diff?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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