8000 Add git grep · kevinSuttle/github-cheat-sheet@9f3abb6 · GitHub
[go: up one dir, main page]

Skip to content

Commit 9f3abb6

Browse files
committed
Add git grep
1 parent c0b8651 commit 9f3abb6

File tree

1 file changed

+27
-0
lines changed

1 file changed

+27
-0
lines changed

README.md

Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -57,6 +57,7 @@ A collection of cool hidden and not so hidden features of Git and GitHub. This c
5757
- [Styled Git Status](#styled-git-status)
5858
- [Styled Git Log](#styled-git-log)
5959
- [Git Query](#git-query)
60+
- [Git Grep](#git-grep)
6061
- [Merged Branches](#merged-branches)
6162
- [Fixup and Autosquash](#fixup-and-autosquash)
6263
- [Web Server for Browsing Local Repositories](#web-server-for-browsing-local-repositories)
@@ -764,6 +765,32 @@ $ git show :/typo
764765

765766
*Press `q` to quit.*
766767

768+
769+
### Git Grep
770+
Grep pattern under your git versioned folder.
771+
772+
Running:
773+
```
774+
git grep aliases
775+
```
776+
will show all the files containing the string *aliases*.
777+
778+
![git grep aliases](http://i.imgur.com/q3WkUgl.png?1)
779+
780+
*Press `q` to quit.*
781+
782+
We can also use multiple flags for more advanced search. For example:
783+
784+
* `-e` The next parameter is the pattern (including regex)
785+
* `--and` Combine multiple patterns.
786+
787+
Use it like this:
788+
```
789+
git grep -e pattern --and -e anotherpattern
790+
```
791+
792+
[*Read more about the Git `grep` command.*](http://git-scm.com/docs/git-grep)
793+
767794
### Merged Branches
768795
Running:
769796

0 commit comments

Comments
 (0)
0