Hello,

when nothing is staged in the index then `git commit` warns about this fact with either "nothing to commit, working directory clean" or "no changes added to commit". However, `git commit --amend --no-edit` will happily record a new commit that differs in nothing than its commit date from the original.

This is unexpected and can lead to mistakes. Without running `git status`, the user will not notice that his unstaged changes were not commited, as everything behaves as expected otherwise (the success output from `commit`, the new commit id in the log, `push` requiring the force option, etc).

I understand that `--amend` is (can be) used for editing commit messages, authors, authoring dates etc. I would however like to see any `--amend` command that results in no changes to the tree, the commit message and the authoring metadata reject the commit with an appropriate warning similar to the one that a plain `git commit` would present. It should be overrideable by the `--allow-emtpy` parameter as well.

If this change detection is somehow unfeasible, I would at least like the `git commit --amend --no-edit` command (with no other flags) to check the tree in the same way as `git commit` does, as the intention of `--no-edit` is even more clear and running the command is more obviously a mistake/lapse.

Kind regards,
 Bergi
--
To unsubscribe from this list: send the line "unsubscribe git" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

Reply via email to