Created
February 26, 2016 16:19
-
-
Save benjamincharity/94604beb49e6258483d0 to your computer and use it in GitHub Desktop.
Git grep within a specific sub-directory.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Search for `analytics` only inside `./src/app` | |
git grep analytics -- "./src/app/*" |
@nickmeldrum what if you want to search for 'src/app'? how would you do that?
Sometimes it's not so much about 'less characters' but more about the precision of the command.
The double dash is an delimiter for 'end of options' so the program is sure that you're sending paths instead of search arguments.
It can be applied to most coreutils and you can find more on this answer
@benjamincharity Exactly what I was looking for. thanks!
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
on my version of git (
2.17.1
) the following behaves the same as above with less characters to type:git grep analytics src/app