本文介绍了如何在工作树中更改的行中查找文本?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我在回购的工作树中有一些修改过的文件,我想在这些文件的变化行中搜索一些文本。我只能使用您可以使用 git diff 来做到这一点,然后将其管理到 grep :
git diff --unified = 0 | grep --ignore-casetext
设置 - unified = 0 确保只返回已更改的行,而没有它们的上下文。
I have some modified files in my repo's working tree, and I want to search for some text in the changed lines of these files. I can only find how to search in the previous commits using git grep.
How can I achieve this?
解决方案
You can do this by using git diff and then pipe it to grep:
git diff --unified=0 | grep --ignore-case "text"
Setting --unified=0 makes sure that only the changed lines are returned, without their context.
这篇关于如何在工作树中更改的行中查找文本?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!