Interplane page as plain text, for reading tools and agents. English is the reference text: translate it with your own tool. Text in backticks and in ``` blocks (commands, fingerprints, file names) and link targets in <...> are exact: copy them, never translate them. Page: /drakestapleton/git/blob/master/Documentation/git-log.adoc # git [Ported from github.com/git/git] Sync with Git 2.56.1 Brought by drakestapleton Sign in to star 0 stars 0 watching About Files History Releases Proposed changes Issues For developers branch `master` Branches Tags History `git / Documentation / git-log.adoc` 228 lines ยท 6949 bytes Raw Blame History 1 git-log(1) 2 ========== 3 4 NAME 5 ---- 6 git-log - Show commit logs 7 8 9 SYNOPSIS 10 -------- 11 [synopsis] 12 git log [] [] [[--] ...] 13 14 DESCRIPTION 15 ----------- 16 Shows the commit logs. 17 18 :git-log: 1 19 include::rev-list-description.adoc[] 20 21 The command takes options applicable to the linkgit:git-rev-list[1] 22 command to control what is shown and how, and options applicable to 23 the linkgit:git-diff[1] command to control how the changes 24 each commit introduces are shown. 25 26 27 OPTIONS 28 ------- 29 30 `--follow`:: 31 Continue listing the history of a file beyond renames 32 (works only for a single file). 33 34 `--no-decorate`:: 35 `--decorate[=(short|full|auto|no)]`:: 36 Print out the ref names of any commits that are shown. Possible values 37 are: 38 + 39 -- 40 `short`;; the ref name prefixes `refs/heads/`, `refs/tags/` and 41 `refs/remotes/` are not printed. 42 `full`;; the full ref name (including prefix) is printed. 43 `auto`;; if the output is going to a terminal, the ref names 44 are shown as if `short` were given, otherwise no ref names are 45 shown. 46 -- 47 + 48 The option `--decorate` is short-hand for `--decorate=short`. Default to 49 configuration value of `log.decorate` if configured, otherwise, `auto`. 50 51 `--decorate-refs=`:: 52 `--decorate-refs-exclude=`:: 53 For each candidate reference, do not use it for decoration if it 54 matches any of the __ parameters given to 55 `--decorate-refs-exclude` or if it doesn't match any of the 56 __ parameters given to `--decorate-refs`. 57 The `log.excludeDecoration` config option allows excluding refs from 58 the decorations, but an explicit `--decorate-refs` pattern will 59 override a match in `log.excludeDecoration`. 60 + 61 If none of these options or config settings are given, then references are 62 used as decoration if they match `HEAD`, `refs/heads/`, `refs/remotes/`, 63 `refs/stash/`, or `refs/tags/`. 64 65 `--clear-decorations`:: 66 When specified, this option clears all previous `--decorate-refs` 67 or `--decorate-refs-exclude` options and relaxes the default 68 decoration filter to include all references. This option is 69 assumed if the config value `log.initialDecorationSet` is set to 70 `all`. 71 72 `--source`:: 73 Print out the ref name given on the command line by which each 74 commit was reached. 75 76 `--mailmap`:: 77 `--no-mailmap`:: 78 `--use-mailmap`:: 79 `--no-use-mailmap`:: 80 Use mailmap file to map author and committer names and email 81 addresses to canonical real names and email addresses. See 82 linkgit:git-shortlog[1]. 83 84 `--full-diff`:: 85 Without this flag, `git log -p ...` shows commits that 86 touch the specified paths, and diffs about the same specified 87 paths. With this, the full diff is shown for commits that touch 88 the specified paths; this means that "`...`" limits only 89 commits, and doesn't limit diff for those commits. 90 + 91 Note that this affects all diff-based output types, e.g. those 92 produced by `--stat`, etc. 93 94 `--log-size`:: 95 Include a line `log size ` in the output for each commit, 96 where __ is the length of that commit's message in bytes. 97 Intended to speed up tools that read log messages from `git log` 98 output by allowing them to allocate space in advance. 99 100 include::line-range-options.adoc[] 101 102 __:: 103 Show only commits in the specified revision range. When no 104 __ is specified, it defaults to `HEAD` (i.e. the 105 whole history leading to the current commit). `origin..HEAD` 106 specifies all the commits reachable from the current commit 107 (i.e. `HEAD`), but not from `origin`. For a complete list of 108 ways to spell __, see the 'Specifying Ranges' 109 section of linkgit:gitrevisions[7]. 110 111 `[--] ...`:: 112 Show only commits that are enough to explain how the files 113 that match the specified paths came to be. See 'History 114 Simplification' below for details and other simplification 115 modes. 116 + 117 Paths may need to be prefixed with `--` to separate them from 118 options or the revision range, when confusion arises. 119 120 include::rev-list-options.adoc[] 121 122 include::pretty-formats.adoc[] 123 124 DIFF FORMATTING 125 --------------- 126 127 By default, `git log` does not generate any diff output. The options 128 below can be used to show the changes made by each commit. 129 130 Note that unless one of `--diff-merges` variants (including short 131 `-m`, `-c`, `--cc`, and `--dd` options) is explicitly given, merge commits 132 will not show a diff, even if a diff format like `--patch` is 133 selected, nor will they match search options like `-S`. The exception 134 is when `--first-parent` is in use, in which case `first-parent` is 135 the default format for merge commits. 136 137 :git-log: 1 138 :diff-merges-default: `off` 139 include::diff-options.adoc[] 140 141 include::diff-generate-patch.adoc[] 142 143 EXAMPLES 144 -------- 145 `git log --no-merges`:: 146 147 Show the whole commit history, but skip any merges 148 149 `git log v2.6.12.. include/scsi drivers/scsi`:: 150 151 Show all commits since version 'v2.6.12' that changed any file 152 in the `include/scsi` or `drivers/scsi` subdirectories 153 154 `git log --since="2 weeks ago" -- gitk`:: 155 156 Show the changes during the last two weeks to the file `gitk`. 157 The `--` is necessary to avoid confusion with the *branch* named 158 `gitk` 159 160 `git log --name-status release..test`:: 161 162 Show the commits that are in the "`test`" branch but not yet 163 in the "`release`" branch, along with the list of paths 164 each commit modifies. 165 166 `git log --follow builtin/rev-list.c`:: 167 168 Shows the commits that changed `builtin/rev-list.c`, including 169 those commits that occurred before the file was given its 170 present name. 171 172 `git log --branches --not --remotes=origin`:: 173 174 Shows all commits that are in any of local branches but not in 175 any of remote-tracking branches for `origin` (what you have that 176 origin doesn't). 177 178 `git log master --not --remotes=*/master`:: 179 180 Shows all commits that are in local master but not in any remote 181 repository master branches. 182 183 `git log -p -m --first-parent`:: 184 185 Shows the history including change diffs, but only from the 186 ``main branch'' perspective, skipping commits that come from merged 187 branches, and showing full diffs of changes introduced by the merges. 188 This makes sense only when following a strict policy of merging all 189 topic branches when staying on a single integration branch. 190 191 `git log -L '/int main/',/^}/:main.c`:: 192 193 Shows how the function `main()` in the file `main.c` evolved 194 over time. 195 196 `git log -3`:: 197 198 Limits the number of commits to show to 3. 199 200 DISCUSSION 201 ---------- 202 203 include::i18n.adoc[] 204 205 CONFIGURATION 206 ------------- 207 208 See linkgit:git-config[1] for core variables and linkgit:git-diff[1] 209 for settings related to diff generation. 210 211 `format.pretty`:: 212 Default for the `--format` option. (See 'Pretty Formats' above.) 213 Defaults to `medium`. 214 215 `i18n.logOutputEncoding`:: 216 Encoding to use when displaying logs. (See 'Discussion' above.) 217 Defaults to the value of `i18n.commitEncoding` if set, and UTF-8 218 otherwise. 219 220 include::includes/cmd-config-section-rest.adoc[] 221 222 include::config/log.adoc[] 223 224 include::config/notes.adoc[] 225 226 GIT 227 --- 228 Part of the linkgit:git[1] suite