Is there a git find
analogue of git grep
, i.e., something that will find a filename by pattern in the tree? I've gone through a lot of git documentation and not found this, but I'm having a hard time believing it doesn't exist somewhere.
Git ships with a command called grep that allows you to easily search through any committed tree, the working directory, or even the index for a string or regular expression.
You typically obtain a Git repository in one of two ways: You can take a local directory that is currently not under version control, and turn it into a Git repository, or. You can clone an existing Git repository from elsewhere.
`git grep` command is used to search in the checkout branch and local files. But if the user is searching the content in one branch, but the content is stored in another branch of the repository, then he/she will not get the searching output.
Find what file changed in a commit To find out which files changed in a given commit, use the git log --raw command. It's the fastest and simplest way to get insight into which files a commit affects.
You can list all files in a tree object using git ls-tree -r --name-only --full-tree <treeish>
. Pipe this through a regular grep to find what you're looking for.
Try git-ls-tree
and run the output through grep(1)
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With