When I start a commit from console (zsh on mac os Terminal) using git commit -a, then Emacs opens two windows as emacsclient in my existing Emacs App Window. One is the correct COMMIT_EDITMSG. The other is a magit-diff window. However, magit uses HEAD^ instead of HEAD as revision. The title says "Changes from HEAD^ to working tree" and that is what is shown.

In contrast, when I run magit-commit from within Emacs, the correct magit-diff window is opened, showing HEAD agains my working tree.

Any idea why this is and how I can fix it?

Emacs from brew: GNU Emacs 25.2.1 (x86_64-apple-darwin13.4.0, NS appkit-1265.21 Version 10.9.5 (Build 13F1911)) of 2017-04-21
Magit 20180410.1528, Git 2.17.0, Emacs 25.2.1, darwin

2 Answers 2


Both diffs can be useful and you can toggle between them by pressing C-c C-d.

Initially the diff is shown using the function magit-commit-diff, which decides which of these diffs to show based on the value of last-command, or if that isn't one of the commands it knows how to handle it falls back to this:

(if (magit-anything-staged-p)
    (magit-diff-staged nil args)
  (magit-diff-while-amending args))

Since you didn't invoke the commit using a Magit command, magit-commit-diff does not know which diff would be most appropriate and falls back to the above heuristic.


Just to be clear, using C-c C-d after using git commit -a will toggle to Staged Changes (which may be empty) and the HEAD^ vs. working tree diff. It doesn't toggle to HEAD vs. working tree for me.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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