Junio C Hamano | 4c43d65 | 2014-10-20 21:14:29 | [diff] [blame] | 1 | git-interpret-trailers(1) |
| 2 | ========================= |
| 3 | |
| 4 | NAME |
| 5 | ---- |
Junio C Hamano | b551377 | 2019-04-22 03:38:39 | [diff] [blame] | 6 | git-interpret-trailers - Add or parse structured information in commit messages |
Junio C Hamano | 4c43d65 | 2014-10-20 21:14:29 | [diff] [blame] | 7 | |
| 8 | SYNOPSIS |
| 9 | -------- |
| 10 | [verse] |
Junio C Hamano | c9cb517 | 2018-06-01 07:13:44 | [diff] [blame] | 11 | 'git interpret-trailers' [<options>] [(--trailer <token>[(=|:)<value>])...] [<file>...] |
| 12 | 'git interpret-trailers' [<options>] [--parse] [<file>...] |
Junio C Hamano | 4c43d65 | 2014-10-20 21:14:29 | [diff] [blame] | 13 | |
| 14 | DESCRIPTION |
| 15 | ----------- |
Junio C Hamano | fb1fdf1 | 2017-08-27 06:14:59 | [diff] [blame] | 16 | Help parsing or adding 'trailers' lines, that look similar to RFC 822 e-mail |
Junio C Hamano | 4c43d65 | 2014-10-20 21:14:29 | [diff] [blame] | 17 | headers, at the end of the otherwise free-form part of a commit |
| 18 | message. |
| 19 | |
| 20 | This command reads some patches or commit messages from either the |
Junio C Hamano | fb1fdf1 | 2017-08-27 06:14:59 | [diff] [blame] | 21 | <file> arguments or the standard input if no <file> is specified. If |
| 22 | `--parse` is specified, the output consists of the parsed trailers. |
| 23 | |
| 24 | Otherwise, this command applies the arguments passed using the |
| 25 | `--trailer` option, if any, to the commit message part of each input |
| 26 | file. The result is emitted on the standard output. |
Junio C Hamano | 4c43d65 | 2014-10-20 21:14:29 | [diff] [blame] | 27 | |
| 28 | Some configuration variables control the way the `--trailer` arguments |
| 29 | are applied to each commit message and the way any existing trailer in |
| 30 | the commit message is changed. They also make it possible to |
| 31 | automatically add some trailers. |
| 32 | |
| 33 | By default, a '<token>=<value>' or '<token>:<value>' argument given |
| 34 | using `--trailer` will be appended after the existing trailers only if |
| 35 | the last trailer has a different (<token>, <value>) pair (or if there |
| 36 | is no existing trailer). The <token> and <value> parts will be trimmed |
| 37 | to remove starting and trailing whitespace, and the resulting trimmed |
| 38 | <token> and <value> will appear in the message like this: |
| 39 | |
| 40 | ------------------------------------------------ |
| 41 | token: value |
| 42 | ------------------------------------------------ |
| 43 | |
| 44 | This means that the trimmed <token> and <value> will be separated by |
| 45 | `': '` (one colon followed by one space). |
| 46 | |
| 47 | By default the new trailer will appear at the end of all the existing |
| 48 | trailers. If there is no existing trailer, the new trailer will appear |
Junio C Hamano | fb5ffde | 2014-11-04 22:38:56 | [diff] [blame] | 49 | after the commit message part of the output, and, if there is no line |
Junio C Hamano | 4c43d65 | 2014-10-20 21:14:29 | [diff] [blame] | 50 | with only spaces at the end of the commit message part, one blank line |
| 51 | will be added before the new trailer. |
| 52 | |
| 53 | Existing trailers are extracted from the input message by looking for |
Junio C Hamano | 615c3b3 | 2018-02-28 23:40:27 | [diff] [blame] | 54 | a group of one or more lines that (i) is all trailers, or (ii) contains at |
Junio C Hamano | ca78549 | 2016-11-23 20:12:30 | [diff] [blame] | 55 | least one Git-generated or user-configured trailer and consists of at |
| 56 | least 25% trailers. |
Junio C Hamano | f2f28b1 | 2016-10-31 21:41:58 | [diff] [blame] | 57 | The group must be preceded by one or more empty (or whitespace-only) lines. |
Junio C Hamano | 4c43d65 | 2014-10-20 21:14:29 | [diff] [blame] | 58 | The group must either be at the end of the message or be the last |
Junio C Hamano | 980e61e | 2018-09-17 22:45:52 | [diff] [blame] | 59 | non-whitespace lines before a line that starts with '---' (followed by a |
| 60 | space or the end of the line). Such three minus signs start the patch |
| 61 | part of the message. See also `--no-divider` below. |
Junio C Hamano | 4c43d65 | 2014-10-20 21:14:29 | [diff] [blame] | 62 | |
Junio C Hamano | f2f28b1 | 2016-10-31 21:41:58 | [diff] [blame] | 63 | When reading trailers, there can be whitespaces after the |
Junio C Hamano | 4c43d65 | 2014-10-20 21:14:29 | [diff] [blame] | 64 | token, the separator and the value. There can also be whitespaces |
Junio C Hamano | f2f28b1 | 2016-10-31 21:41:58 | [diff] [blame] | 65 | inside the token and the value. The value may be split over multiple lines with |
| 66 | each subsequent line starting with whitespace, like the "folding" in RFC 822. |
Junio C Hamano | 4c43d65 | 2014-10-20 21:14:29 | [diff] [blame] | 67 | |
| 68 | Note that 'trailers' do not follow and are not intended to follow many |
Junio C Hamano | f2f28b1 | 2016-10-31 21:41:58 | [diff] [blame] | 69 | rules for RFC 822 headers. For example they do not follow |
| 70 | the encoding rules and probably many other rules. |
Junio C Hamano | 4c43d65 | 2014-10-20 21:14:29 | [diff] [blame] | 71 | |
| 72 | OPTIONS |
| 73 | ------- |
Junio C Hamano | 7d09864 | 2016-01-30 00:05:21 | [diff] [blame] | 74 | --in-place:: |
| 75 | Edit the files in place. |
| 76 | |
Junio C Hamano | 4c43d65 | 2014-10-20 21:14:29 | [diff] [blame] | 77 | --trim-empty:: |
| 78 | If the <value> part of any trailer contains only whitespace, |
| 79 | the whole trailer will be removed from the resulting message. |
Junio C Hamano | b0a1e83 | 2015-10-15 23:08:31 | [diff] [blame] | 80 | This applies to existing trailers as well as new trailers. |
Junio C Hamano | 4c43d65 | 2014-10-20 21:14:29 | [diff] [blame] | 81 | |
| 82 | --trailer <token>[(=|:)<value>]:: |
| 83 | Specify a (<token>, <value>) pair that should be applied as a |
| 84 | trailer to the input messages. See the description of this |
| 85 | command. |
| 86 | |
Junio C Hamano | fb1fdf1 | 2017-08-27 06:14:59 | [diff] [blame] | 87 | --where <placement>:: |
| 88 | --no-where:: |
| 89 | Specify where all new trailers will be added. A setting |
| 90 | provided with '--where' overrides all configuration variables |
| 91 | and applies to all '--trailer' options until the next occurrence of |
Junio C Hamano | bfd91f4 | 2018-08-17 22:21:16 | [diff] [blame] | 92 | '--where' or '--no-where'. Possible values are `after`, `before`, |
| 93 | `end` or `start`. |
Junio C Hamano | fb1fdf1 | 2017-08-27 06:14:59 | [diff] [blame] | 94 | |
| 95 | --if-exists <action>:: |
| 96 | --no-if-exists:: |
| 97 | Specify what action will be performed when there is already at |
| 98 | least one trailer with the same <token> in the message. A setting |
| 99 | provided with '--if-exists' overrides all configuration variables |
| 100 | and applies to all '--trailer' options until the next occurrence of |
Junio C Hamano | bfd91f4 | 2018-08-17 22:21:16 | [diff] [blame] | 101 | '--if-exists' or '--no-if-exists'. Possible actions are `addIfDifferent`, |
| 102 | `addIfDifferentNeighbor`, `add`, `replace` and `doNothing`. |
Junio C Hamano | fb1fdf1 | 2017-08-27 06:14:59 | [diff] [blame] | 103 | |
| 104 | --if-missing <action>:: |
| 105 | --no-if-missing:: |
| 106 | Specify what action will be performed when there is no other |
| 107 | trailer with the same <token> in the message. A setting |
| 108 | provided with '--if-missing' overrides all configuration variables |
| 109 | and applies to all '--trailer' options until the next occurrence of |
Junio C Hamano | bfd91f4 | 2018-08-17 22:21:16 | [diff] [blame] | 110 | '--if-missing' or '--no-if-missing'. Possible actions are `doNothing` |
| 111 | or `add`. |
Junio C Hamano | fb1fdf1 | 2017-08-27 06:14:59 | [diff] [blame] | 112 | |
| 113 | --only-trailers:: |
| 114 | Output only the trailers, not any other parts of the input. |
| 115 | |
| 116 | --only-input:: |
| 117 | Output only trailers that exist in the input; do not add any |
| 118 | from the command-line or by following configured `trailer.*` |
| 119 | rules. |
| 120 | |
| 121 | --unfold:: |
| 122 | Remove any whitespace-continuation in trailers, so that each |
| 123 | trailer appears on a line by itself with its full content. |
| 124 | |
| 125 | --parse:: |
| 126 | A convenience alias for `--only-trailers --only-input |
| 127 | --unfold`. |
| 128 | |
Junio C Hamano | 980e61e | 2018-09-17 22:45:52 | [diff] [blame] | 129 | --no-divider:: |
| 130 | Do not treat `---` as the end of the commit message. Use this |
| 131 | when you know your input contains just the commit message itself |
| 132 | (and not an email or the output of `git format-patch`). |
| 133 | |
Junio C Hamano | 4c43d65 | 2014-10-20 21:14:29 | [diff] [blame] | 134 | CONFIGURATION VARIABLES |
| 135 | ----------------------- |
| 136 | |
| 137 | trailer.separators:: |
| 138 | This option tells which characters are recognized as trailer |
| 139 | separators. By default only ':' is recognized as a trailer |
| 140 | separator, except that '=' is always accepted on the command |
| 141 | line for compatibility with other git commands. |
| 142 | + |
| 143 | The first character given by this option will be the default character |
| 144 | used when another separator is not specified in the config for this |
| 145 | trailer. |
| 146 | + |
| 147 | For example, if the value for this option is "%=$", then only lines |
| 148 | using the format '<token><sep><value>' with <sep> containing '%', '=' |
| 149 | or '$' and then spaces will be considered trailers. And '%' will be |
| 150 | the default separator used, so by default trailers will appear like: |
| 151 | '<token>% <value>' (one percent sign and one space will appear between |
| 152 | the token and the value). |
| 153 | |
| 154 | trailer.where:: |
| 155 | This option tells where a new trailer will be added. |
| 156 | + |
| 157 | This can be `end`, which is the default, `start`, `after` or `before`. |
| 158 | + |
| 159 | If it is `end`, then each new trailer will appear at the end of the |
| 160 | existing trailers. |
| 161 | + |
| 162 | If it is `start`, then each new trailer will appear at the start, |
| 163 | instead of the end, of the existing trailers. |
| 164 | + |
| 165 | If it is `after`, then each new trailer will appear just after the |
| 166 | last trailer with the same <token>. |
| 167 | + |
| 168 | If it is `before`, then each new trailer will appear just before the |
| 169 | first trailer with the same <token>. |
| 170 | |
| 171 | trailer.ifexists:: |
| 172 | This option makes it possible to choose what action will be |
| 173 | performed when there is already at least one trailer with the |
| 174 | same <token> in the message. |
| 175 | + |
| 176 | The valid values for this option are: `addIfDifferentNeighbor` (this |
Junio C Hamano | 222ed82 | 2017-06-02 06:24:06 | [diff] [blame] | 177 | is the default), `addIfDifferent`, `add`, `replace` or `doNothing`. |
Junio C Hamano | 4c43d65 | 2014-10-20 21:14:29 | [diff] [blame] | 178 | + |
| 179 | With `addIfDifferentNeighbor`, a new trailer will be added only if no |
| 180 | trailer with the same (<token>, <value>) pair is above or below the line |
| 181 | where the new trailer will be added. |
| 182 | + |
| 183 | With `addIfDifferent`, a new trailer will be added only if no trailer |
| 184 | with the same (<token>, <value>) pair is already in the message. |
| 185 | + |
| 186 | With `add`, a new trailer will be added, even if some trailers with |
| 187 | the same (<token>, <value>) pair are already in the message. |
| 188 | + |
| 189 | With `replace`, an existing trailer with the same <token> will be |
| 190 | deleted and the new trailer will be added. The deleted trailer will be |
| 191 | the closest one (with the same <token>) to the place where the new one |
| 192 | will be added. |
| 193 | + |
| 194 | With `doNothing`, nothing will be done; that is no new trailer will be |
| 195 | added if there is already one with the same <token> in the message. |
| 196 | |
| 197 | trailer.ifmissing:: |
| 198 | This option makes it possible to choose what action will be |
| 199 | performed when there is not yet any trailer with the same |
| 200 | <token> in the message. |
| 201 | + |
| 202 | The valid values for this option are: `add` (this is the default) and |
| 203 | `doNothing`. |
| 204 | + |
| 205 | With `add`, a new trailer will be added. |
| 206 | + |
| 207 | With `doNothing`, nothing will be done. |
| 208 | |
| 209 | trailer.<token>.key:: |
| 210 | This `key` will be used instead of <token> in the trailer. At |
| 211 | the end of this key, a separator can appear and then some |
| 212 | space characters. By default the only valid separator is ':', |
| 213 | but this can be changed using the `trailer.separators` config |
| 214 | variable. |
| 215 | + |
| 216 | If there is a separator, then the key will be used instead of both the |
| 217 | <token> and the default separator when adding the trailer. |
| 218 | |
| 219 | trailer.<token>.where:: |
| 220 | This option takes the same values as the 'trailer.where' |
| 221 | configuration variable and it overrides what is specified by |
| 222 | that option for trailers with the specified <token>. |
| 223 | |
Junio C Hamano | fb1fdf1 | 2017-08-27 06:14:59 | [diff] [blame] | 224 | trailer.<token>.ifexists:: |
| 225 | This option takes the same values as the 'trailer.ifexists' |
Junio C Hamano | 4c43d65 | 2014-10-20 21:14:29 | [diff] [blame] | 226 | configuration variable and it overrides what is specified by |
| 227 | that option for trailers with the specified <token>. |
| 228 | |
| 229 | trailer.<token>.ifmissing:: |
| 230 | This option takes the same values as the 'trailer.ifmissing' |
| 231 | configuration variable and it overrides what is specified by |
| 232 | that option for trailers with the specified <token>. |
| 233 | |
| 234 | trailer.<token>.command:: |
Junio C Hamano | 51a55bc | 2021-05-12 05:22:19 | [diff] [blame] | 235 | This option behaves in the same way as 'trailer.<token>.cmd', except |
| 236 | that it doesn't pass anything as argument to the specified command. |
| 237 | Instead the first occurrence of substring $ARG is replaced by the |
| 238 | value that would be passed as argument. |
Junio C Hamano | 4c43d65 | 2014-10-20 21:14:29 | [diff] [blame] | 239 | + |
Junio C Hamano | 51a55bc | 2021-05-12 05:22:19 | [diff] [blame] | 240 | The 'trailer.<token>.command' option has been deprecated in favor of |
| 241 | 'trailer.<token>.cmd' due to the fact that $ARG in the user's command is |
| 242 | only replaced once and that the original way of replacing $ARG is not safe. |
Junio C Hamano | 4c43d65 | 2014-10-20 21:14:29 | [diff] [blame] | 243 | + |
Junio C Hamano | 51a55bc | 2021-05-12 05:22:19 | [diff] [blame] | 244 | When both 'trailer.<token>.cmd' and 'trailer.<token>.command' are given |
| 245 | for the same <token>, 'trailer.<token>.cmd' is used and |
| 246 | 'trailer.<token>.command' is ignored. |
| 247 | |
| 248 | trailer.<token>.cmd:: |
| 249 | This option can be used to specify a shell command that will be called: |
| 250 | once to automatically add a trailer with the specified <token>, and then |
| 251 | each time a '--trailer <token>=<value>' argument to modify the <value> of |
| 252 | the trailer that this option would produce. |
Junio C Hamano | 4c43d65 | 2014-10-20 21:14:29 | [diff] [blame] | 253 | + |
Junio C Hamano | 51a55bc | 2021-05-12 05:22:19 | [diff] [blame] | 254 | When the specified command is first called to add a trailer |
| 255 | with the specified <token>, the behavior is as if a special |
| 256 | '--trailer <token>=<value>' argument was added at the beginning |
| 257 | of the "git interpret-trailers" command, where <value> |
| 258 | is taken to be the standard output of the command with any |
| 259 | leading and trailing whitespace trimmed off. |
| 260 | + |
| 261 | If some '--trailer <token>=<value>' arguments are also passed |
| 262 | on the command line, the command is called again once for each |
| 263 | of these arguments with the same <token>. And the <value> part |
| 264 | of these arguments, if any, will be passed to the command as its |
| 265 | first argument. This way the command can produce a <value> computed |
| 266 | from the <value> passed in the '--trailer <token>=<value>' argument. |
Junio C Hamano | 4c43d65 | 2014-10-20 21:14:29 | [diff] [blame] | 267 | |
| 268 | EXAMPLES |
| 269 | -------- |
| 270 | |
| 271 | * Configure a 'sign' trailer with a 'Signed-off-by' key, and then |
| 272 | add two of these trailers to a message: |
| 273 | + |
| 274 | ------------ |
| 275 | $ git config trailer.sign.key "Signed-off-by" |
| 276 | $ cat msg.txt |
| 277 | subject |
| 278 | |
| 279 | message |
| 280 | $ cat msg.txt | git interpret-trailers --trailer 'sign: Alice <alice@example.com>' --trailer 'sign: Bob <bob@example.com>' |
| 281 | subject |
| 282 | |
| 283 | message |
| 284 | |
| 285 | Signed-off-by: Alice <alice@example.com> |
| 286 | Signed-off-by: Bob <bob@example.com> |
| 287 | ------------ |
| 288 | |
Junio C Hamano | 92d8037 | 2016-07-13 22:00:05 | [diff] [blame] | 289 | * Use the `--in-place` option to edit a message file in place: |
Junio C Hamano | 7d09864 | 2016-01-30 00:05:21 | [diff] [blame] | 290 | + |
| 291 | ------------ |
| 292 | $ cat msg.txt |
| 293 | subject |
| 294 | |
| 295 | message |
| 296 | |
| 297 | Signed-off-by: Bob <bob@example.com> |
| 298 | $ git interpret-trailers --trailer 'Acked-by: Alice <alice@example.com>' --in-place msg.txt |
| 299 | $ cat msg.txt |
| 300 | subject |
| 301 | |
| 302 | message |
| 303 | |
| 304 | Signed-off-by: Bob <bob@example.com> |
| 305 | Acked-by: Alice <alice@example.com> |
| 306 | ------------ |
| 307 | |
Junio C Hamano | 4c43d65 | 2014-10-20 21:14:29 | [diff] [blame] | 308 | * Extract the last commit as a patch, and add a 'Cc' and a |
| 309 | 'Reviewed-by' trailer to it: |
| 310 | + |
| 311 | ------------ |
| 312 | $ git format-patch -1 |
| 313 | 0001-foo.patch |
| 314 | $ git interpret-trailers --trailer 'Cc: Alice <alice@example.com>' --trailer 'Reviewed-by: Bob <bob@example.com>' 0001-foo.patch >0001-bar.patch |
| 315 | ------------ |
| 316 | |
| 317 | * Configure a 'sign' trailer with a command to automatically add a |
| 318 | 'Signed-off-by: ' with the author information only if there is no |
| 319 | 'Signed-off-by: ' already, and show how it works: |
| 320 | + |
| 321 | ------------ |
| 322 | $ git config trailer.sign.key "Signed-off-by: " |
| 323 | $ git config trailer.sign.ifmissing add |
| 324 | $ git config trailer.sign.ifexists doNothing |
| 325 | $ git config trailer.sign.command 'echo "$(git config user.name) <$(git config user.email)>"' |
| 326 | $ git interpret-trailers <<EOF |
| 327 | > EOF |
| 328 | |
| 329 | Signed-off-by: Bob <bob@example.com> |
| 330 | $ git interpret-trailers <<EOF |
| 331 | > Signed-off-by: Alice <alice@example.com> |
| 332 | > EOF |
| 333 | |
| 334 | Signed-off-by: Alice <alice@example.com> |
| 335 | ------------ |
| 336 | |
| 337 | * Configure a 'fix' trailer with a key that contains a '#' and no |
| 338 | space after this character, and show how it works: |
| 339 | + |
| 340 | ------------ |
| 341 | $ git config trailer.separators ":#" |
| 342 | $ git config trailer.fix.key "Fix #" |
| 343 | $ echo "subject" | git interpret-trailers --trailer fix=42 |
| 344 | subject |
| 345 | |
| 346 | Fix #42 |
| 347 | ------------ |
| 348 | |
Junio C Hamano | 51a55bc | 2021-05-12 05:22:19 | [diff] [blame] | 349 | * Configure a 'help' trailer with a cmd use a script `glog-find-author` |
| 350 | which search specified author identity from git log in git repository |
| 351 | and show how it works: |
| 352 | + |
| 353 | ------------ |
| 354 | $ cat ~/bin/glog-find-author |
| 355 | #!/bin/sh |
| 356 | test -n "$1" && git log --author="$1" --pretty="%an <%ae>" -1 || true |
| 357 | $ git config trailer.help.key "Helped-by: " |
| 358 | $ git config trailer.help.ifExists "addIfDifferentNeighbor" |
| 359 | $ git config trailer.help.cmd "~/bin/glog-find-author" |
| 360 | $ git interpret-trailers --trailer="help:Junio" --trailer="help:Couder" <<EOF |
| 361 | > subject |
| 362 | > |
| 363 | > message |
| 364 | > |
| 365 | > EOF |
| 366 | subject |
| 367 | |
| 368 | message |
| 369 | |
| 370 | Helped-by: Junio C Hamano <gitster@pobox.com> |
| 371 | Helped-by: Christian Couder <christian.couder@gmail.com> |
| 372 | ------------ |
| 373 | |
| 374 | * Configure a 'ref' trailer with a cmd use a script `glog-grep` |
| 375 | to grep last relevant commit from git log in the git repository |
| 376 | and show how it works: |
| 377 | + |
| 378 | ------------ |
| 379 | $ cat ~/bin/glog-grep |
| 380 | #!/bin/sh |
| 381 | test -n "$1" && git log --grep "$1" --pretty=reference -1 || true |
| 382 | $ git config trailer.ref.key "Reference-to: " |
| 383 | $ git config trailer.ref.ifExists "replace" |
| 384 | $ git config trailer.ref.cmd "~/bin/glog-grep" |
| 385 | $ git interpret-trailers --trailer="ref:Add copyright notices." <<EOF |
| 386 | > subject |
| 387 | > |
| 388 | > message |
| 389 | > |
| 390 | > EOF |
| 391 | subject |
| 392 | |
| 393 | message |
| 394 | |
| 395 | Reference-to: 8bc9a0c769 (Add copyright notices., 2005-04-07) |
| 396 | ------------ |
| 397 | |
Junio C Hamano | 4c43d65 | 2014-10-20 21:14:29 | [diff] [blame] | 398 | * Configure a 'see' trailer with a command to show the subject of a |
| 399 | commit that is related, and show how it works: |
| 400 | + |
| 401 | ------------ |
| 402 | $ git config trailer.see.key "See-also: " |
| 403 | $ git config trailer.see.ifExists "replace" |
| 404 | $ git config trailer.see.ifMissing "doNothing" |
| 405 | $ git config trailer.see.command "git log -1 --oneline --format=\"%h (%s)\" --abbrev-commit --abbrev=14 \$ARG" |
| 406 | $ git interpret-trailers <<EOF |
| 407 | > subject |
| 408 | > |
| 409 | > message |
| 410 | > |
| 411 | > see: HEAD~2 |
| 412 | > EOF |
| 413 | subject |
| 414 | |
| 415 | message |
| 416 | |
| 417 | See-also: fe3187489d69c4 (subject of related commit) |
| 418 | ------------ |
| 419 | |
| 420 | * Configure a commit template with some trailers with empty values |
| 421 | (using sed to show and keep the trailing spaces at the end of the |
| 422 | trailers), then configure a commit-msg hook that uses |
| 423 | 'git interpret-trailers' to remove trailers with empty values and |
| 424 | to add a 'git-version' trailer: |
| 425 | + |
| 426 | ------------ |
| 427 | $ sed -e 's/ Z$/ /' >commit_template.txt <<EOF |
| 428 | > ***subject*** |
| 429 | > |
| 430 | > ***message*** |
| 431 | > |
| 432 | > Fixes: Z |
| 433 | > Cc: Z |
| 434 | > Reviewed-by: Z |
| 435 | > Signed-off-by: Z |
| 436 | > EOF |
| 437 | $ git config commit.template commit_template.txt |
| 438 | $ cat >.git/hooks/commit-msg <<EOF |
| 439 | > #!/bin/sh |
| 440 | > git interpret-trailers --trim-empty --trailer "git-version: \$(git describe)" "\$1" > "\$1.new" |
| 441 | > mv "\$1.new" "\$1" |
| 442 | > EOF |
| 443 | $ chmod +x .git/hooks/commit-msg |
| 444 | ------------ |
| 445 | |
| 446 | SEE ALSO |
| 447 | -------- |
| 448 | linkgit:git-commit[1], linkgit:git-format-patch[1], linkgit:git-config[1] |
| 449 | |
| 450 | GIT |
| 451 | --- |
| 452 | Part of the linkgit:git[1] suite |