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/pretty-formats.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 / pretty-formats.adoc` 422 lines ยท 16096 bytes Raw Blame History 1 PRETTY FORMATS 2 -------------- 3 4 If the commit is a merge, and if the pretty-format 5 is not `oneline`, `email` or `raw`, an additional line is 6 inserted before the `Author:` line. This line begins with 7 "Merge: " and the hashes of ancestral commits are printed, 8 separated by spaces. Note that the listed commits may not 9 necessarily be the list of the 'direct' parent commits if you 10 have limited your view of history: for example, if you are 11 only interested in changes related to a certain directory or 12 file. 13 14 There are several built-in formats, and you can define 15 additional formats by setting a pretty. 16 config option to either another format name, or a 17 `format:` string, as described below (see 18 linkgit:git-config[1]). Here are the details of the 19 built-in formats: 20 21 `oneline`:: 22 + 23 [synopsis] 24 -- 25 26 -- 27 + 28 This is designed to be as compact as possible. 29 30 `short`:: 31 + 32 [synopsis] 33 -- 34 commit 35 Author: 36 37 38 -- 39 40 `medium`:: 41 + 42 [synopsis] 43 -- 44 commit 45 Author: 46 Date: 47 48 49 50 51 -- 52 53 `full`:: 54 + 55 [synopsis] 56 -- 57 commit 58 Author: 59 Commit: 60 61 62 63 64 -- 65 66 `fuller`:: 67 + 68 [synopsis] 69 -- 70 commit 71 Author: 72 AuthorDate: 73 Commit: 74 CommitDate: 75 76 77 78 79 -- 80 81 `reference`:: 82 + 83 [synopsis] 84 -- 85 (, ) 86 -- 87 + 88 This format is used to refer to another commit in a commit message and 89 is the same as ++--pretty=\'format:%C(auto)%h (%s, %ad)'++. By default, 90 the date is formatted with `--date=short` unless another `--date` option 91 is explicitly specified. As with any `format:` with format 92 placeholders, its output is not affected by other options like 93 `--decorate` and `--walk-reflogs`. 94 95 `email`:: 96 + 97 [synopsis] 98 -- 99 From 100 From: 101 Date: 102 Subject: [PATCH] 103 104 105 -- 106 107 `mboxrd`:: 108 Like `email`, but lines in the commit message starting with "From " 109 (preceded by zero or more ">") are quoted with ">" so they aren't 110 confused as starting a new commit. 111 112 `raw`:: 113 The `raw` format shows the entire commit exactly as 114 stored in the commit object. Notably, the hashes are 115 displayed in full, regardless of whether `--abbrev` or 116 `--no-abbrev` are used, and 'parents' information show the 117 true parent commits, without taking grafts or history 118 simplification into account. Note that this format affects the way 119 commits are displayed, but not the way the diff is shown e.g. with 120 `git log --raw`. To get full object names in a raw diff format, 121 use `--no-abbrev`. 122 123 `format:`:: 124 The `format:` format allows you to specify which information 125 you want to show. It works a little bit like printf format, 126 with the notable exception that you get a newline with `%n` 127 instead of `\n`. 128 + 129 E.g, 'format:"The author of %h was %an, %ar%nThe title was >>%s<<%n"' 130 would show something like this: 131 + 132 ------- 133 The author of `fe6e0ee` was Junio C Hamano, 23 hours ago 134 The title was >>t4119: test autocomputing -p for traditional diff input.<< 135 136 ------- 137 + 138 The placeholders are: 139 140 - Placeholders that expand to a single literal character: 141 + 142 -- 143 ++%n++:: newline 144 ++%%++:: a raw ++%++ 145 ++%x00++:: ++%x++ followed by two hexadecimal digits is replaced with a 146 byte with the hexadecimal digits' value (we will call this 147 "literal formatting code" in the rest of this document). 148 -- 149 150 - Placeholders that affect formatting of later placeholders: 151 + 152 -- 153 ++%Cred++:: switch color to red 154 ++%Cgreen++:: switch color to green 155 ++%Cblue++:: switch color to blue 156 ++%Creset++:: reset color 157 ++%C(++__++)++:: color specification, as described under Values in the 158 "CONFIGURATION FILE" section of linkgit:git-config[1]. By 159 default, colors are shown only when enabled for log output 160 (by `color.diff`, `color.ui`, or `--color`, and respecting 161 the `auto` settings of the former if we are going to a 162 terminal). ++%C(auto,++__++)++ is accepted as a historical 163 synonym for the default (e.g., ++%C(auto,red)++). Specifying 164 ++%C(always,++__++)++ will show the colors even when color is 165 not otherwise enabled (though consider just using 166 `--color=always` to enable color for the whole output, 167 including this format and anything else git might color). 168 `auto` alone (i.e. ++%C(auto)++) will turn on auto coloring 169 on the next placeholders until the color is switched 170 again. 171 ++%m++:: left (`<`), right (`>`) or boundary (`-`) mark 172 ++%w(++`[[,[,]]]`++)++:: switch line wrapping, like the `-w` option of 173 linkgit:git-shortlog[1]. 174 ++%<(++`[,(trunc|ltrunc|mtrunc)]`++)++:: make the next placeholder take at 175 least N column widths, padding spaces on 176 the right if necessary. Optionally 177 truncate (with ellipsis `..`) at the left (ltrunc) `..ft`, 178 the middle (mtrunc) `mi..le`, or the end 179 (trunc) `rig..`, if the output is longer than 180 __ columns. 181 Note 1: that truncating 182 only works correctly with __ >= 2. 183 Note 2: spaces around the __ and __ (see below) 184 values are optional. 185 Note 3: Emojis and other wide characters 186 will take two display columns, which may 187 over-run column boundaries. 188 Note 4: decomposed character combining marks 189 may be misplaced at padding boundaries. 190 ++%<|(++__ ++)++:: make the next placeholder take at least until __ th 191 display column, padding spaces on the right if necessary. 192 Use negative __ values for column positions measured 193 from the right hand edge of the terminal window. 194 ++%>(++__++)++:: 195 ++%>|(++__++)++:: similar to ++%<(++__++)++, ++%<|(++__++)++ respectively, 196 but padding spaces on the left 197 ++%>>(++__++)++:: 198 ++%>>|(++__++)++:: similar to ++%>(++__++)++, ++%>|(++__++)++ 199 respectively, except that if the next 200 placeholder takes more spaces than given and 201 there are spaces on its left, use those 202 spaces 203 ++%><(++__++)++:: 204 ++%><|(++__++)++:: similar to ++%<(++__++)++, ++%<|(++__++)++ 205 respectively, but padding both sides 206 (i.e. the text is centered) 207 -- 208 209 - Placeholders that expand to information extracted from the commit: 210 + 211 -- 212 +%H+:: commit hash 213 +%h+:: abbreviated commit hash 214 +%T+:: tree hash 215 +%t+:: abbreviated tree hash 216 +%P+:: parent hashes 217 +%p+:: abbreviated parent hashes 218 +%an+:: author name 219 +%aN+:: author name (respecting .mailmap, see linkgit:git-shortlog[1] 220 or linkgit:git-blame[1]) 221 +%ae+:: author email 222 +%aE+:: author email (respecting .mailmap, see linkgit:git-shortlog[1] 223 or linkgit:git-blame[1]) 224 +%al+:: author email local-part (the part before the `@` sign) 225 +%aL+:: author local-part (see +%al+) respecting .mailmap, see 226 linkgit:git-shortlog[1] or linkgit:git-blame[1]) 227 +%ad+:: author date (format respects --date= option) 228 +%aD+:: author date, RFC2822 style 229 +%ar+:: author date, relative 230 +%at+:: author date, UNIX timestamp 231 +%ai+:: author date, ISO 8601-like format 232 +%aI+:: author date, strict ISO 8601 format 233 +%as+:: author date, short format (`YYYY-MM-DD`) 234 +%ah+:: author date, human style (like the `--date=human` option of 235 linkgit:git-rev-list[1]) 236 +%cn+:: committer name 237 +%cN+:: committer name (respecting .mailmap, see 238 linkgit:git-shortlog[1] or linkgit:git-blame[1]) 239 +%ce+:: committer email 240 +%cE+:: committer email (respecting .mailmap, see 241 linkgit:git-shortlog[1] or linkgit:git-blame[1]) 242 +%cl+:: committer email local-part (the part before the `@` sign) 243 +%cL+:: committer local-part (see +%cl+) respecting .mailmap, see 244 linkgit:git-shortlog[1] or linkgit:git-blame[1]) 245 +%cd+:: committer date (format respects --date= option) 246 +%cD+:: committer date, RFC2822 style 247 +%cr+:: committer date, relative 248 +%ct+:: committer date, UNIX timestamp 249 +%ci+:: committer date, ISO 8601-like format 250 +%cI+:: committer date, strict ISO 8601 format 251 +%cs+:: committer date, short format (`YYYY-MM-DD`) 252 +%ch+:: committer date, human style (like the `--date=human` option of 253 linkgit:git-rev-list[1]) 254 +%d+:: ref names, like the --decorate option of linkgit:git-log[1] 255 +%D+:: ref names without the " (", ")" wrapping. 256 +%(count)+:: the number of a patch within a patch series. Used only in 257 `--commit-list-format` in `format-patch` 258 +%(total)+:: the total number of patches in a patch series. Used only in 259 `--commit-list-format` in `format-patch` 260 ++%(decorate++`[: