Git commit message pane empty, where is default template?
Answered
Whenever I commit command line, I get a default comment in my editor. Like so:
# Please enter the commit message for your changes. Lines starting
# with '#' will be ignored, and an empty message aborts the commit.
# On branch my-branch-name
# Your branch is up-to-date with 'origin/my-branch-name'.
#
# Changes to be committed:
# modified: somefile.py
#
# Changes not staged for commit:
# modified: someotherfile.py
#
# Untracked files:
# somethingelse.txt
#
I add my message at the top.
In PyCharm my commit message pane is empty, I do not get the above default. I would very much like to see it, how can I accomplish that?
Please sign in to leave a comment.
Please vote for https://youtrack.jetbrains.com/issue/IDEA-66355 to increase its priority and be notified about updates.
This is not the same thing, but likely related. Check out this explanation: http://stackoverflow.com/a/34859567/5366881 by user torek. I printed the text below. I am specifically talking about step 3. Printing this message, or not printing it, is a separate operation from using or not using a commit template. So I added my vote with a note about this.
Text from stackoverflow answer:
You seem to be mixing up the
commit.templateoption (which provides a default value for the--templateoption togit commit) with theprepare-commit-messagehook.Normally
git commituses the following sequence of operations:# Please enter the commit message ...and the output ofgit status.prepare-commit-messagehook, if it exists and is runnable, on the temporary file.$GIT_EDITOR, thecore.editorconfiguration,$VISUAL,$EDITOR, or a built-in default, whichever is the first one set.)If you use the
-for-moptions, steps 2, 3, and 5 are normally skipped (though you can force git to open your editor by adding--edit). Presumably you have not used those options.What the
--templateoption does—and hence whatcommit.templatedoes—is to provides the path name of a file thatgit commitwill copy in step 2. This does not affect lines added in step 3. While the path.git/hooks/prepare-commit-messageis (probably) a file git can read, it's not a very sensible name for your template, since if that same path is made executable, the file will become runnable and step 4 will probably behave badly.You can tell
git commitnot to do step 3 by adding--no-status. (Also, as a somewhat odd side effect,--no-edit, which explicitly suppresses step 5, also suppresses step 3.)Or, you can make use of step 4 to eliminate some or all of the
git statusoutput and standard# Please enter...message. Theprepare-commit-messagehook can make arbitrary changes to the template file.Note that
--cleanup=<mode>affects what winds up in the final commit message, and also the processing of step 6. For details see thegit commitdocumentation.