Your comments

+1 for this feature, this is one of the very few things I find myself needing to use the CLI for instead of SmartGit.

Hi Thomas, apologies for the slow reply, I hadn't noticed your message - I think it would be fine to have a button or something to manually invoke the prepare-commit-msg hook, but it would be great if it could be done automatically - is there some reason that my suggestion above wouldn't work? 

Also, just for clarity - I'm referring to the

prepare-commit-msg

hook, and NOT the

commit-msg

hook. 

With reference to https://smartgit.userecho.com/communities/1/topics/528-more-distinct-colored-file-statuses, I understand not wanting to frustrate users with changes, but I really think that, at the very least, the skip-worktree icon should change to be more visually distinct from the unchanged file icon. These icons look nearly identical, especially on some monitors or in certain lighting conditions. Something like a small glyph containing a symbol like ⏩ would be suitable, I think.

Personally, I think the small glyphs on the file icons should be clearer in general - I'd go with a larger 8x8 glyph overlaying the file icon rather than a coloured box containing 12 pixels or whatever it is at present

My suggestion would be to invoke the prepare-commit-msg hook:

  • When the commit modal dialog (CTRL+K) is opened
  • When the text area in the Commit window (Ctrl+Shift+6) gains focus, and the value of that text area is an empty string or matches the contents of the configured commit.template file.

Additionally, if the text area in the Commit window loses focus before the value of the text area is changed, the value of that text area should be set to the contents of the configured commit.template file, or an empty string.

    All of my commit messages in a certain repository always begin with the identifier of the Jira ticket I'm working on, which can be a string of up to 10 characters.

    This identifier is also always at the beginning of the name of the branch, always in the same format. It is used in our tools to link commits, branches, pull requests, and tickets together.


    For example, when viewing a ticket in Jira, recent commits and branches which contain the ticket identifier are shown in the sidebar.

    At present, I am doing this by either typing the identifier manually, or by copying the branch name, pasting it into the commit message, and manually deleting the git flow prefix and a short ticket description, such as "improve_report_performance".

    I have made mistakes in the past when entering it manually (e.g. entering TCKT-56536 instead of TCKT-56356) which leads to the commit being linked to the wrong ticket - this can be resolved by amending the commit message, but it's a pain.

    Copying the branch name, then copying the identifier, then pasting it, is quite a repetitive, time-consuming task.

    It would be very helpful to make use of the prepare-commit hook to get the ticket identifier from the branch name and prepend it to the commit message using a script.

    This is just a very simple example of how the hook could be used; I imagine there are workflows vastly more complex than mine for which this would be a great benefit.

    Surprised at the lack of support for this feature - another vote to implement support for this hook, it would improve my workflow.