I am searching through a Git repository and would like to include the .git folder.
grep does not include this folder if I run
grep -r search *
What would be a grep command to include this folder?
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
Please refer to the solution at the end of this post as a better alternative to what you’re doing.
You can explicitly include hidden files (a directory is also a file).
The
*will match all files except hidden ones and.[^.]*will match only hidden files without... However this will fail if there are either no non-hidden files or no hidden files in a given directory. You could of course explicitly add.gitinstead of.*.However, if you simply want to search in a given directory, do it like this:
The
.will match the current path, which will include both non-hidden and hidden files.