@@ -280,7 +280,7 @@ $ cat msg.txt
280
280
subject
281
281
282
282
message
283
- $
cat msg.txt | git interpret-trailers --trailer 'sign: Alice <
[email protected] >' --trailer 'sign: Bob <
[email protected] >'
283
+ $ git interpret-trailers --trailer 'sign: Alice <
[email protected] >' --trailer 'sign: Bob <
[email protected] >'
<msg.txt
284
284
subject
285
285
286
286
message
@@ -322,17 +322,30 @@ $ git interpret-trailers --trailer 'Cc: Alice <
[email protected] >' --trailer 'Re
322
322
'Signed-off-by: ' already, and show how it works:
323
323
+
324
324
------------
325
+ $ cat msg1.txt
326
+ subject
327
+
328
+ message
325
329
$ git config trailer.sign.key "Signed-off-by: "
326
330
$ git config trailer.sign.ifmissing add
327
331
$ git config trailer.sign.ifexists doNothing
328
- $ git config trailer.sign.command 'echo "$(git config user.name) <$(git config user.email)>"'
329
- $ git interpret-trailers <<EOF
330
- > EOF
332
+ $ git config trailer.sign.cmd 'echo "$(git config user.name) <$(git config user.email)>"'
333
+ $ git interpret-trailers --trailer sign <msg1.txt
334
+ subject
335
+
336
+ message
331
337
332
338
Signed-off-by: Bob <
[email protected] >
333
- $ git interpret-trailers <<EOF
334
- > Signed-off-by: Alice <
[email protected] >
335
- > EOF
339
+ $ cat msg2.txt
340
+ subject
341
+
342
+ message
343
+
344
+ Signed-off-by: Alice <
[email protected] >
345
+ $ git interpret-trailers --trailer sign <msg2.txt
346
+ subject
347
+
348
+ message
336
349
337
350
Signed-off-by: Alice <
[email protected] >
338
351
------------
@@ -357,15 +370,14 @@ Fix #42
357
370
$ cat ~/bin/glog-find-author
358
371
#!/bin/sh
359
372
test -n "$1" && git log --author="$1" --pretty="%an <%ae>" -1 || true
373
+ $ cat msg.txt
374
+ subject
375
+
376
+ message
360
377
$ git config trailer.help.key "Helped-by: "
361
378
$ git config trailer.help.ifExists "addIfDifferentNeighbor"
362
379
$ git config trailer.help.cmd "~/bin/glog-find-author"
363
- $ git interpret-trailers --trailer="help:Junio" --trailer="help:Couder" <<EOF
364
- > subject
365
- >
366
- > message
367
- >
368
- > EOF
380
+ $ git interpret-trailers --trailer="help:Junio" --trailer="help:Couder" <msg.txt
369
381
subject
370
382
371
383
message
382
394
$ cat ~/bin/glog-grep
383
395
#!/bin/sh
384
396
test -n "$1" && git log --grep "$1" --pretty=reference -1 || true
397
+ $ cat msg.txt
398
+ subject
399
+
400
+ message
385
401
$ git config trailer.ref.key "Reference-to: "
386
402
$ git config trailer.ref.ifExists "replace"
387
403
$ git config trailer.ref.cmd "~/bin/glog-grep"
388
- $ git interpret-trailers --trailer="ref:Add copyright notices." <<EOF
389
- > subject
390
- >
391
- > message
392
- >
393
- > EOF
404
+ $ git interpret-trailers --trailer="ref:Add copyright notices." <msg.txt
394
405
subject
395
406
396
407
message
@@ -402,17 +413,20 @@ Reference-to: 8bc9a0c769 (Add copyright notices., 2005-04-07)
402
413
commit that is related, and show how it works:
403
414
+
404
415
------------
416
+ $ cat msg.txt
417
+ subject
418
+
419
+ message
420
+
421
+ see: HEAD~2
422
+ $ cat ~/bin/glog-ref
423
+ #!/bin/sh
424
+ git log -1 --oneline --format="%h (%s)" --abbrev-commit --abbrev=14
405
425
$ git config trailer.see.key "See-also: "
406
426
$ git config trailer.see.ifExists "replace"
407
427
$ git config trailer.see.ifMissing "doNothing"
408
- $ git config trailer.see.command "git log -1 --oneline --format=\"%h (%s)\" --abbrev-commit --abbrev=14 \$ARG"
409
- $ git interpret-trailers <<EOF
410
- > subject
411
- >
412
- > message
413
- >
414
- > see: HEAD~2
415
- > EOF
428
+ $ git config trailer.see.cmd "glog-ref"
429
+ $ git interpret-trailers --trailer=see <msg.txt
416
430
subject
417
431
418
432
message
@@ -427,22 +441,21 @@ See-also: fe3187489d69c4 (subject of related commit)
427
441
to add a 'git-version' trailer:
428
442
+
429
443
------------
430
- $ sed -e 's/ Z$/ /' >commit_template .txt <<EOF
431
- > ***subject***
432
- >
433
- > ***message***
434
- >
435
- > Fixes: Z
436
- > Cc: Z
437
- > Reviewed-by: Z
438
- > Signed-off-by: Z
439
- > EOF
444
+ $ cat temp .txt
445
+ ***subject***
446
+
447
+ ***message***
448
+
449
+ Fixes: Z
450
+ Cc: Z
451
+ Reviewed-by: Z
452
+ Signed-off-by: Z
453
+ $ sed -e 's/ Z$/ /' temp.txt > commit_template.txt
440
454
$ git config commit.template commit_template.txt
441
- $ cat >.git/hooks/commit-msg <<EOF
442
- > #!/bin/sh
443
- > git interpret-trailers --trim-empty --trailer "git-version: \$(git describe)" "\$1" > "\$1.new"
444
- > mv "\$1.new" "\$1"
445
- > EOF
455
+ $ cat .git/hooks/commit-msg
456
+ #!/bin/sh
457
+ git interpret-trailers --trim-empty --trailer "git-version: \$(git describe)" "\$1" > "\$1.new"
458
+ mv "\$1.new" "\$1"
446
459
$ chmod +x .git/hooks/commit-msg
447
460
------------
448
461
0 commit comments