[Question] git-commit: --template from cmd output

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



I'm trying to customize the commit message instructions showing up in text
editor after `git commit`. Checking the docs, I found these flags of interest:

- commit.verbose: useful flag to see the diff of changes done.
- commit.status: for toggling whether to show status or not.
- commit.template: this is what I was looking for, but when I checked the doc,
  it turned out to be a useless.

IMO, all of these flags are redundant and should be combined in one flag done in
the Unix way of doing one thing and doing it well, which is displaying commit
message comments within the editor.

The way to do it is by having commit.template as a script:

commit.template = "echo $COMMENTED_INSTRUCTIONS; git diff" # commit --verbose
commit.template = "echo $COMMENTED_INSTRUCTIONS; git status" # commit --status
commit.template = "" # commit --no-status
commit.template = "cat path/to/commit-msg-template" # original commit --template

Where COMMENTED_INSTRUCTIONS are the lorem ipsum printed every time git commit is issued:
# Please enter the commit message for your changes. Lines starting
# with '#' will be ignored, and an empty message aborts the commit.

Of course, to maintain compatibility, these options would stay, but my
suggestion is to have a way for commit.template to read from command output
instead of a file.

-- Avid Seeker

Attachment: publickey - avidseeker7@protonmail.com - 0x7EECE85C.asc
Description: application/pgp-keys

Attachment: signature.asc
Description: OpenPGP digital signature


[Index of Archives]     [Linux Kernel Development]     [Gcc Help]     [IETF Annouce]     [DCCP]     [Netdev]     [Networking]     [Security]     [V4L]     [Bugtraq]     [Yosemite]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Linux SCSI]     [Fedora Users]

  Powered by Linux