9

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

tarsius
  • 25,298
  • 4
  • 69
  • 109
qhfgva
  • 91
  • 2
  • 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

2 Answers2

7

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 #
tarsius
  • 25,298
  • 4
  • 69
  • 109
Nsukami _
  • 6,341
  • 2
  • 22
  • 35
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.
abo-abo
  • 13,943
  • 1
  • 29
  • 43