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.
This commit is contained in:
parent
8a979172c8
commit
f89a045282
2 changed files with 8 additions and 4 deletions
7
magit.el
7
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
|
||||
|
|
|
@ -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
|
||||
|
|
Loading…
Reference in a new issue