Git development
 help / color / mirror / Atom feed
* [PATCH 0/2] commit: preserve commit hash on a no-op amend
@ 2026-06-13  9:16 Harald Nordgren via GitGitGadget
  2026-06-13  9:16 ` [PATCH 1/2] commit: extract commit_index_files_or_die() helper Harald Nordgren via GitGitGadget
                   ` (2 more replies)
  0 siblings, 3 replies; 4+ messages in thread
From: Harald Nordgren via GitGitGadget @ 2026-06-13  9:16 UTC (permalink / raw)
  To: git; +Cc: Harald Nordgren

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
Published-As: https://github.com/gitgitgadget/git/releases/tag/pr-git-2334%2FHaraldNordgren%2Famend-noop-keeps-commit-v1
Fetch-It-Via: git fetch https://github.com/gitgitgadget/git pr-git-2334/HaraldNordgren/amend-noop-keeps-commit-v1
Pull-Request: https://github.com/git/git/pull/2334
-- 
gitgitgadget

^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2026-06-13  9:59 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-06-13  9:16 [PATCH 0/2] commit: preserve commit hash on a no-op amend Harald Nordgren via GitGitGadget
2026-06-13  9:16 ` [PATCH 1/2] commit: extract commit_index_files_or_die() helper Harald Nordgren via GitGitGadget
2026-06-13  9:16 ` [PATCH 2/2] commit: keep the commit on a no-op amend Harald Nordgren via GitGitGadget
2026-06-13  9:59 ` [PATCH 0/2] commit: preserve commit hash " Johannes Sixt

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox