Skip to content

Commit 71ab4f4

Browse files
committed
Add recipe for searching commits
1 parent ae94810 commit 71ab4f4

1 file changed

Lines changed: 12 additions & 1 deletion

File tree

tools/dev.md

Lines changed: 12 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ where
2525
* `s/[^-][^\/]*\//--/g`: replace directory path segments with `--`.
2626
* `s/^/ /`: indent.
2727
* `s/--/|/`: replace the first `--` with a vertical bar.
28-
28+
2929

3030
### git
3131

@@ -40,6 +40,17 @@ $ git diff -U0 | grep '^[+-]' | grep -Ev '^(--- a/|\+\+\+ b/)'
4040
which selects for all lines beginning with either a `+` or `-` character and then removes lines listing the filename.
4141

4242

43+
#### Search Commits
44+
45+
To search all commits for a particular string,
46+
47+
``` bash
48+
$ git rev-list --all | xargs git grep -F 'string'
49+
```
50+
51+
where `-F` indicates to search for a fixed string. To search using a regular expression, use `-P` (see `git grep --help`).
52+
53+
4354
### Find and Replace
4455

4556
#### Multi-file

0 commit comments

Comments
 (0)