Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

What is the recommended equivalent to git grep #1404

Answered by Byron
phlax asked this question in Q&A
Discussion options

Im shifting some code from bash to python that makes use of git grep

Im wondering if there is a recommended way to do this - eg with a predicate in traverse or using execute

Im particularly keen to replicate git grep's -I functionality which filters out "binary" files from gits pov (ie .gitattributes)

You must be logged in to vote

GitPython won't help much here as it merely acts as wrapper around git to allow something like repo.git.grep(I=true), the result has to be parsed by hand. There is no other support for grep like functionality or gitattributes.

Replies: 1 comment

Comment options

GitPython won't help much here as it merely acts as wrapper around git to allow something like repo.git.grep(I=true), the result has to be parsed by hand. There is no other support for grep like functionality or gitattributes.

You must be logged in to vote
0 replies
Answer selected by Byron
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants
Converted from issue

This discussion was converted from issue #1403 on January 29, 2022 01:16.

AltStyle によって変換されたページ (->オリジナル) /