Jonathan Cobo
Jonathan Cobo

Reputation: 117

GIT search string in all repositories

I need to modify a database table, so I would like to know how many applications access that table. Is there any git command to search for a string in all repositories?

Upvotes: 8

Views: 3265

Answers (2)

Erik Svedin
Erik Svedin

Reputation: 1286

Since its across multiple repositorys you might step out of git and just go with bash to search through all different folders recursively.

A similar question has been answered here: search for text pattern and here: Bash search for a particular string

grep example from answer above:

grep -R "MY_DATABASE_STRING" *

Upvotes: 1

fazermokeur
fazermokeur

Reputation: 39

According to git documentation you can use this command line to count on each matching files the number of occurence or your research

git grep --count the_string_you_need

or use -n to print out the line numbers where Git has found matches.

Full doc is here: https://git-scm.com/book/en/v2/Git-Tools-Searching

Upvotes: 0

Related Questions