diff --git a/README.md b/README.md index b3e88a3..c0c6d4f 100644 --- a/README.md +++ b/README.md @@ -115,6 +115,7 @@ P.S: All these commands are tested on `git version 2.7.4 (Apple Git-66)`. * [Turn off git colored terminal output](#turn-off-git-colored-terminal-output) * [specific color settings](#specific-color-settings) * [Show all local branches ordered by recent commits](#show-all-local-branches-ordered-by-recent-commits) +* [Find lines matching the pattern (regex or string) in tracked files](#find-lines-matching-the-pattern-regex-or-string-in-tracked-files) @@ -628,7 +629,7 @@ git config --global core.ignorecase false ## Add custom editors. ```sh - git config --global core.editor '$EDITOR' +git config --global core.editor '$EDITOR' ``` ## Auto correct typos. @@ -793,5 +794,10 @@ git config --global git for-each-ref --sort=-committerdate --format='%(refname:short)' refs/heads/ ``` +## Find lines matching the pattern (regex or string) in tracked files +```sh +git grep --heading --line-number 'foo bar' +``` + diff --git a/tips.json b/tips.json index f69c476..0678b6b 100644 --- a/tips.json +++ b/tips.json @@ -348,4 +348,7 @@ },{ "title": "Show all local branches ordered by recent commits", "tip": "git for-each-ref --sort=-committerdate --format='%(refname:short)' refs/heads/" +},{ + "title": "Find lines matching the pattern (regex or string) in tracked files", + "tip": "git grep --heading --line-number 'foo bar'" }]