From f89a045282f5e216af2754e21a2d6c54ba8532fa Mon Sep 17 00:00:00 2001 From: Marius Vollmer Date: Tue, 10 Feb 2009 23:28:21 +0200 Subject: [PATCH] Only ever commit staged changes when amending a commit. The usual behavior of committing all unstaged changes when there are no staged changes makes it impossible to amend a commit just to fix the commit message, which is a quite common thing to do. * magit.el (magit-log-edit-commit): Do not pass "--all" to git commit when amending. --- magit.el | 7 ++++--- magit.texi | 5 ++++- 2 files changed, 8 insertions(+), 4 deletions(-) diff --git a/magit.el b/magit.el index 4a9e3741..aa2c8ac8 100644 --- a/magit.el +++ b/magit.el @@ -2098,12 +2098,13 @@ Prefix arg means justify as well." (let ((commit-buf (current-buffer))) (with-current-buffer (magit-find-buffer 'status default-directory) (cond (tag - (magit-run-with-input commit-buf - magit-git-executable "tag" tag "-a" "-F" "-")) + (magit-run-with-input + commit-buf + magit-git-executable "tag" tag "-a" "-F" "-")) (t (apply #'magit-run-with-input commit-buf magit-git-executable "commit" "-F" "-" - (append (if (not (magit-anything-staged-p)) + (append (if (not (or amend (magit-anything-staged-p))) '("--all") '()) (if amend '("--amend") '()) (if magit-commit-signoff diff --git a/magit.texi b/magit.texi index 73135c31..2381a052 100644 --- a/magit.texi +++ b/magit.texi @@ -240,7 +240,10 @@ committed. You can type @kbd{C-c C-a} in the buffer with the change description toggles a flag that determines whether the next commit will be a -@emph{amending} one. +@emph{amending} one. When amending a commit, only the staged changes +are committed, even if there are none. (Normally, all unstaged +changes are committed when there are no staged changes.) This allows +you to easily modify the message of the last commit. Typing @kbd{C} will also pop up the change description buffer, but in addition, it will try to insert a ChangeLog-style entry for the change