git grep 在 git 中搜索文件内容

git 文件 搜索 grep 内容 字符串 如果 编程技术
发布日期 2022-10-23 更新日期 2022-10-23 阅读次数 107 文章字数 179

在工作目录中,搜索包含的文件【必须被git缓存,而不能是git ignore的文件】

git grep 字符串

如果需要行号,添加 -n 

git grep -n 字符串

如果仅希望获取文件名,使用 --name-only

如果希望统计在文件中出现了几次,则使用 -c

git grep -c 字符串

对于 bare 的空仓库【非work仓库,仅git服务器】,需要加上指定的分支名称

git grep 字符串 master


文章作者: 朱丰华

文章链接: https://smart.52dixiaowo.com/blog/post-148.html

版权声明: 本博客所有文章除特別声明外,均采用 CC BY 4.0 许可协议。

git 文件 搜索 grep 内容 字符串 如果

发表评论

相关推荐
朱丰华   |   4个月前   |   启动 · php

debian12开机启动sh

236    评论    点赞
朱丰华   |   1年前   |   git

git从缓存中移除数据git rm --cached

538    评论    点赞
朱丰华   |   1年前   |   页面 · 监听

iframe子父页面信息传递与监听

581    评论    点赞
朱丰华   |   1年前   |   linux · upx

Linux下安装UPX

687    评论    点赞
朱丰华   |   1年前   |   git

git push -u参数是什么意思?--set-upstream

400    评论    点赞
朱丰华   |   1年前   |   git · hub · 仓库

go克隆并引用github仓库

237    评论    点赞
朱丰华   |   1年前   |   请求 · 一个

ab测压命令,apache测压工具

256    评论    点赞
朱丰华   |   1年前   |   php · 缓存 · opcache

php 加速、提高并发opcache

325    评论    点赞
朱丰华   |   1年前   |   go · gopath

Go自定义包并安装(GOPATH)

179    评论    点赞
朱丰华   |   1年前   |   变量 · mysql · sql · 用户

MySQL用户自定义变量

166    评论    点赞
朱丰华   |   1年前   |   sql · php

PHP如何使用PDO批量执行SQL?

192    评论    点赞
朱丰华   |   1年前   |   sed · 文件

Shell 指定行处理head、tail、sed

215    评论    点赞
朱丰华   |   1年前   |   linux · 内容

linux环境下,对于一个大文件,如何查看其中某行的内容

129    评论    点赞
朱丰华   |   1年前   |   linux · 文件 · 行数

linux 取得文件行数

106    评论    点赞
朱丰华   |   1年前   |   下载 · 请求

idm、浏览器下载发送两次下载请求

264    评论    点赞
朱丰华   |   1年前   |   javascript · 滚动 · html

Javascript 显示当前滚动条滚动的百分比

125    评论    点赞
朱丰华   |   1年前   |   文件 · linux · 修改

linux文件的三个时间atime,mtime,ctime分别表示什么?

376    评论    点赞
朱丰华   |   1年前   |   linux · 文件 · 统计

linux递归统计文件夹下的文件数量

279    评论    点赞
朱丰华   |   1年前   |   linux · 文件

linux递归统计文件夹大小、du命令_Linux du命令:查看文件夹和文件的磁盘占用情况

295    评论    点赞
朱丰华   |   1年前   |   git · add · 文件

git add -A 和 git add . 的区别

161    评论    点赞
{{item.author_name}}   |   {{new Date(item.date*1000).log()}}   |   {{it}} ·

{{item.title}}

{{item.uv}}    评论    点赞