Right now, instead of pressing just cc in magit-mode, I have to press c-vc every time to enable --verbose.

Is it possible to make it enabled by default?

up vote 12 down vote accepted

Beginning with v2.1.0, Magit uses the library magit-popup.el to implement such "popup buffers" or "prefix-infix-suffix combos". Despite its name, that library can be used by packages not related to Magit, and is therefore made available as a separate Elpa package. It even has its own manual now!

Default arguments can now be set directly from a popup buffer. To always use --verbose when committing do this:

  1. c Show the committing popup
  2. - v Turn on --verbose
  3. C-x C-s Save the currently set arguments as defaults (in the custom option magit-commit-arguments)

By default all popup buffers end with a section named "Common Commands". If not, use C-t to show it. You probably don't want to see that section all the time and should therefore set magit-popup-show-common-commands to nil.

Of course it is also possible to set the value of magit-commit-arguments and other such variables using the Custom interface, setq, or add-to-list. But I recommend against that, because that would make it impossible to change the defaults on-the-fly.

As far as I can tell Magit does not keep track of "default" options, but we can make it "press -v" every time the Committing buffer pops up:

(advice-add #'magit-key-mode-popup-committing :after
            (lambda ()
              (magit-key-mode-toggle-option (quote committing) "--verbose")))

To find what function to advise, I opened a magic-status buffer and pressed C-h k c. This led me to magit-key-mode-popup-committing. Then (with the Committing buffer still displayed) I pressed C-h k -v to find the lambda form Magit calls when you press -v in the Committing window.

Update: I did write this answer independently, but see Can I have the git-log “--all” option be initially selected?, the answer given there, and comments to that answer.

  • 1
    That's interesting! Thank you for also explaining how you found those functions :) – Dogbert Nov 26 '14 at 10:59
  • @Dogbert: please see the link in the updated answer if you care to know that others thought about default git options not that long ago. :-) (I don't know how I missed that yesterday.) – Constantine Nov 27 '14 at 6:56

While it's not exactly what you want (diff in your commit buffer), you can set magit to expand the staged diffs in the status window:

(setq magit-expand-staged-on-commit 'full)

The magit workflow seems to always be open status buffer and then open split with commit buffer, you always end up with two buffers displayed. The above setting will make the second (previously not useful) buffer display your diff.

You can also use t to only expand the diff headers (so it shows the line numbers):

(setq magit-expand-staged-on-commit t)

While writing your diff, you can switch to the status buffer and use TAB to expand (or fold) the diffs.


Alternatively, you can use C-c C-d from the commit buffer to open another buffer with a diff with magit-diff-staged. (See this issue.)

As of magit version 2.1, you can use this in your config:

;; When commiting enable verbose mode by default.
(setq magit-commit-arguments (quote ("--verbose")))
  • You shouldn't do that. See my answer. – tarsius Jul 3 '15 at 14:57
  • @tarsius You have a valid point. My usecase is that I sync my dotfiles between multiple computers and when I set a default it should be default on all my computers. If I want to change it, I'll just change it in my config and it will be synced across all my computers. – Maiku Mori Jul 3 '15 at 15:01
  • 1
    Oh and I don't use the custom options because it makes my config hard to document. I prefer to set everything explicitly. – Maiku Mori Jul 3 '15 at 15:04
  • Also, setting --no-verify is useful when you have projects that use git hooks (use with caution, obviously). – Droogans Aug 31 '16 at 19:10

Your Answer

By clicking "Post Your Answer", you acknowledge that you have read our updated terms of service, privacy policy and cookie policy, and that your continued use of the website is subject to these policies.

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