8

Is there a simple way to have default text pre-populate in the comment buffer when commiting code with magit?

  • 3
    Are you looking for some static piece of text that is the same for every commit? Or something derived from the staged changes in some way? – glucas Jan 30 '15 at 18:51
  • @qhfgva could you please help us help you by answering our questions. Or does one of existing answers already address your issue? Then you should accept it. – tarsius Mar 11 '15 at 10:14
6

If what you're looking for, is a default template message for a commit, you can put this in your .gitconfig file:

[commit]
    template = /path/to/a/.gitcommitmessagetemplate.txt

And inside .gitcommitmessagetemplate.txt, put whatever you want, example:

type scope: subject

Body

Breaking changes with description of the change, justification
and migration notes.
Closes|Refs #
4

You want magit-commit-add-log, probably.

  1. navigate to a staged hunk
  2. call magit-commit-add-log. It used to be bound to C. You'll get a Changelog-style entry related to the current hunk's function in the commit message.
  • 4
    Could you expand on that answer, maybe with a working example? – Dan Jan 30 '15 at 19:03

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.