pr-git-2334/HaraldNordgren/amend-noop-keeps-commit-v1
pr-git-2334/HaraldNordgren/amend-noop-keeps-commit-v1: commit: preserve commit hash on a no-op amend
tagged this
13 Jun 09:16
git commit --amend --no-edit rewrote the commit and moved the branch tip even when nothing changed, because the committer date was reset to "now". Reuse the existing committer date so a no-op amend keeps the commit hash and leaves the branch untouched. A real change (tree, message, author, committer, or signing) still rewrites as before. Harald Nordgren (2): commit: extract commit_index_files_or_die() helper commit: keep the commit on a no-op amend Documentation/git-commit.adoc | 6 ++ builtin/commit.c | 69 ++++++++++++++- t/t7501-commit-basic-functionality.sh | 119 ++++++++++++++++++++++++++ 3 files changed, 190 insertions(+), 4 deletions(-) base-commit: ea97ad8d017de0c9037451a78008a0fd60abea0c Submitted-As: https://lore.kernel.org/git/pull.2334.git.git.1781342189.gitgitgadget@gmail.com