Differences
This shows you the differences between two versions of the page.
| Next revision | Previous revision | ||
| git_searching [2019/02/21 13:32] – created rpjday | git_searching [2019/02/21 14:17] (current) – [Config options] rpjday | ||
|---|---|---|---|
| Line 7: | Line 7: | ||
| Examples use the Git repository for the "Pro Git" book found [[https:// | Examples use the Git repository for the "Pro Git" book found [[https:// | ||
| + | |||
| + | ===== Searching with "git log" ===== | ||
| + | |||
| + | The '' | ||
| + | |||
| + | ==== Searching for author ==== | ||
| + | |||
| + | < | ||
| + | $ git log --author=" | ||
| + | $ git log --author=" | ||
| + | $ git log --author=" | ||
| + | $ git log --author=" | ||
| + | $ git log --author=" | ||
| + | 104 | ||
| + | $ git log -i --author=" | ||
| + | </ | ||
| + | |||
| + | ==== Searching by date range ==== | ||
| + | |||
| + | < | ||
| + | --since=< | ||
| + | Show commits more recent than a specific date. | ||
| + | |||
| + | --until=< | ||
| + | Show commits older than a specific date. | ||
| + | </ | ||
| + | |||
| + | So: | ||
| + | |||
| + | < | ||
| + | $ git log --since=" | ||
| + | $ git log --author=" | ||
| + | </ | ||
| + | |||
| + | ==== Using the " | ||
| + | |||
| + | < | ||
| + | --grep=< | ||
| + | Limit the commits output to ones with log message that | ||
| + | matches the specified pattern (regular expression). With | ||
| + | more than one --grep=< | ||
| + | matches any of the given patterns are chosen (but see | ||
| + | --all-match). | ||
| + | |||
| + | ... | ||
| + | |||
| + | --all-match | ||
| + | Limit the commits output to ones that match all given | ||
| + | --grep, instead of ones that match at least one. | ||
| + | |||
| + | --invert-grep | ||
| + | Limit the commits output to ones with log message that do | ||
| + | not match the pattern specified with --grep=< | ||
| + | </ | ||
| + | |||
| + | Ignoring case: | ||
| + | |||
| + | < | ||
| + | $ git log --grep=" | ||
| + | 6 | ||
| + | $ git log --grep=" | ||
| + | 9 | ||
| + | $ git log -i --grep=" | ||
| + | 13 | ||
| + | $ | ||
| + | </ | ||
| + | |||
| + | Specifying AND or OR: | ||
| + | |||
| + | < | ||
| + | $ git log -i --grep=" | ||
| + | 66 | ||
| + | $ git log -i --grep=" | ||
| + | 2 | ||
| + | $ git log -i --grep=" | ||
| + | commit 110e27b003c10b4574ee49a47a090e125d6c4811 | ||
| + | Merge: 72d6a54 a402fcf | ||
| + | Author: Ben Straub < | ||
| + | Date: Mon Oct 16 10:30:02 2017 -0700 | ||
| + | |||
| + | Merge pull request #866 from rpjday/ | ||
| + | | ||
| + | Add TIP to tagging section explaining " | ||
| + | |||
| + | commit a402fcf53fb0d8d0c165ca9ee9ce233ea955cb85 | ||
| + | Author: Robert P. J. Day < | ||
| + | Date: Mon Oct 16 01:44:21 2017 -0700 | ||
| + | |||
| + | Add TIP to tagging section explaining " | ||
| + | | ||
| + | - Clarify the need for [-l|--llist] | ||
| + | - Some minor rewording | ||
| + | $ | ||
| + | </ | ||
| + | |||
| + | ==== Ignoring merge commits with " | ||
| + | |||
| + | In many cases, merge commits are of no interest since they simply merge commits that produce actual change. | ||
| + | |||
| + | < | ||
| + | $ git log --author=" | ||
| + | 803 | ||
| + | $ git log --author=" | ||
| + | 300 | ||
| + | $ | ||
| + | </ | ||
| + | |||
| + | ===== Searching with "git grep" ===== | ||
| + | |||
| + | ==== DESCRIPTION ==== | ||
| + | |||
| + | < | ||
| + | Look for specified patterns in the tracked files in the work | ||
| + | tree, blobs registered in the index file, or blobs in given | ||
| + | tree objects. Patterns are lists of one or more search | ||
| + | expressions separated by newline characters. An empty string as | ||
| + | search expression matches all lines. | ||
| + | </ | ||
| + | |||
| + | ==== SYNOPSIS ==== | ||
| + | |||
| + | Options: | ||
| + | |||
| + | < | ||
| + | [-a | --text] [-I] [--textconv] [-i | --ignore-case] [-w | --word-regexp] | ||
| + | [-v | --invert-match] [-h|-H] [--full-name] | ||
| + | [-E | --extended-regexp] [-G | --basic-regexp] | ||
| + | [-P | --perl-regexp] | ||
| + | [-F | --fixed-strings] [-n | --line-number] [--column] | ||
| + | [-l | --files-with-matches] [-L | --files-without-match] | ||
| + | [(-O | --open-files-in-pager) [< | ||
| + | [-z | --null] | ||
| + | [ -o | --only-matching ] [-c | --count] [--all-match] [-q | --quiet] | ||
| + | [--max-depth < | ||
| + | [--color[=< | ||
| + | [--break] [--heading] [-p | --show-function] | ||
| + | [-A < | ||
| + | [-W | --function-context] | ||
| + | [--threads < | ||
| + | [-f < | ||
| + | [--and|--or|--not|(|)|-e < | ||
| + | [-recurse-submodules] [--parent-basename < | ||
| + | [ [--[no-]exclude-standard] [--cached | --no-index | --untracked] | tree> | ||
| + | [--] [< | ||
| + | </ | ||
| + | |||
| + | ==== Config options ==== | ||
| + | |||
| + | * '' | ||
| + | * '' | ||
| + | * '' | ||
| + | * '' | ||
| + | * '' | ||
| + | * '' | ||
| + | |||
| + | See '' | ||
| + | |||
| + | ==== Examples ==== | ||
| + | |||
| + | < | ||
| + | $ git grep -il torvalds | ||
| + | book/ | ||
| + | book/ | ||
| + | $ | ||
| + | </ | ||