不要在git grep输出中显示^ M(回车) [英] Don't display ^M (carriage return) in git grep output
本文介绍了不要在git grep输出中显示^ M(回车)的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
要从 git diff
中隐藏可怕的 ^ M
个字符,必须配置:
To hide the awful ^M
characters from git diff
, one has to config:
[core]
whitespace = cr-at-eol
但它们仍显示在 git grep
输出中。
如何解决?
But they are still displayed in git grep
output.
How to solve that?
编辑-我正在运行的grep是:
EDIT -- The grep I'm running is:
git grep -i --line-number --break --heading -C 1 <PATTERN>
(在Windows上)-R小于 c>作为寻呼机。
in Cygwin (on Windows) with less -R
as pager.
推荐答案
从类似的问题(与 git diff
相关),
将core.pager更改为
tr -d'\r'| less -REX
您可以像这样全局更改此配置,
You can either change this configuration globally like this,
git config --global core.pager "tr -d '\r' | less -REX"
或仅使用一次对于 git grep
,
git -c core.pager="tr -d '\r' | less -REX" grep -i --line-number --break --heading -C 1 <PATTERN>
用户 Jason Pyeron 在此处提供了详尽的解释。
User Jason Pyeron provides a thorough explanation here.
这篇关于不要在git grep输出中显示^ M(回车)的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文