threads / rfc / 66803

RFC patch, 2 partsSupport --verbose in git history

Subject: [RFC PATCH 0/2] Support --verbose in git history

## tl;dr

After list feedback, Jelle van der Waa will drop the proposed --verbose option for git history reword and instead show the diff by default, with an opt-out. Read the story.

replies: 18people: 6as markdown or json

Jelle van der Waa· Nov 7, 2026, 19:30 UTC · lore

The new git history subcommands like reword do not support showing the full git diff when editing the git commit message. This RFC adds support for git history reword behave similiar to git commit --amend --verbose except I choose to leave out support the "commit.verbose" configuration option. Other git history subcommands like split, squash and fixup could also support --verbose under some circumstances (without --no-edit for fixup or only with --reedit-message for fixup)

I would be happy to work start with landing support for --verbose for git history reword, ideally with it also supporting the "commit.verbose" configuration option. Further patches could then add support for other subcommands where it makes sense.

Jelle van der Waa (2):
  history: drop redundant strbuf_stripspace()
  history: add --verbose option for reword
 Documentation/git-history.adoc | 11 +++-
 builtin/history.c              | 61 ++++++++++++++++++---
 t/t3451-history-reword.sh      | 97 ++++++++++++++++++++++++++++++++++
 3 files changed, 160 insertions(+), 9 deletions(-)
-- 
2.56.0
Jelle van der Waa· Nov 7, 2026, 19:30 UTC · re: Jelle van der Waa · lore

[RFC PATCH 1/2] history: drop redundant strbuf_stripspace()

cleanup_message() with COMMIT_MSG_CLEANUP_ALL already calls strbuf_stripspace() with the same arguments.

Signed-off-by: Jelle van der Waa <jelle@vdwaa.nl>
---
 builtin/history.c | 1 -
 1 file changed, 1 deletion(-)
Show changes to builtin/history.c +0 −1
diff --git a/builtin/history.c b/builtin/history.c
index 43ba76f5a1..cdb0d30784 100644
--- a/builtin/history.c
+++ b/builtin/history.c
@@ -94,7 +94,6 @@ static int fill_commit_message(struct repository *repo,
 		fprintf(stderr, _("Aborting commit as launching the editor failed.\n"));
 		return -1;
 	}
-	strbuf_stripspace(out, comment_line_str);
 
 	cleanup_message(out, COMMIT_MSG_CLEANUP_ALL, 0);
 
-- 
2.56.0
Jelle van der Waa· Nov 7, 2026, 19:30 UTC · re: Jelle van der Waa · lore

[RFC PATCH 2/2] history: add --verbose option for reword

When rewording a commit message it is often useful to have context of the changes. This commit implements the --verbose option of git commit in git history reword with the only difference in that it does not folllow the commit.verbose configuration setting.

Signed-off-by: Jelle van der Waa <jelle@vdwaa.nl>
---
 Documentation/git-history.adoc | 11 +++-
 builtin/history.c              | 60 ++++++++++++++++++---
 t/t3451-history-reword.sh      | 97 ++++++++++++++++++++++++++++++++++
 3 files changed, 160 insertions(+), 8 deletions(-)
Show changes to 3 files +160 −8

Documentation/git-history.adoc, builtin/history.c, t/t3451-history-reword.sh

diff --git a/Documentation/git-history.adoc b/Documentation/git-history.adoc
index 1fcc30150a..a476780623 100644
--- a/Documentation/git-history.adoc
+++ b/Documentation/git-history.adoc
@@ -10,7 +10,7 @@ SYNOPSIS
 [synopsis]
 git history drop <commit> [--dry-run] [--update-refs=(branches|head)] [--empty=(drop|keep|abort)] [--[no-]gpg-sign[=<key-id>]]
 git history fixup <commit> [--dry-run] [--update-refs=(branches|head)] [--reedit-message] [--empty=(drop|keep|abort)] [--[no-]gpg-sign[=<key-id>]]
-git history reword <commit> [--dry-run] [--update-refs=(branches|head)] [--[no-]gpg-sign[=<key-id>]]
+git history reword <commit> [--dry-run] [--update-refs=(branches|head)] [-v | --verbose] [--[no-]gpg-sign[=<key-id>]]
 git history split <commit> [--dry-run] [--update-refs=(branches|head)] [--[no-]gpg-sign[=<key-id>]] [--] [<pathspec>...]
 git history squash [--dry-run] [--update-refs=(branches|head)] [--[no-]edit] [--[no-]gpg-sign[=<key-id>]] <revision-range>
 
@@ -180,6 +180,15 @@ OPTIONS
 `--reedit-message`::
 	Open an editor to modify the target commit's message.
 
+`-v`::
+`--verbose`::
+`--no-verbose`::
+	For `reword`, show the diff of the commit being reworded at the bottom
+	of the commit message to help the user describe the commit by reminding
+	what changes the commit has.
+	Note that this diff output doesn't have its lines prefixed with `#`.
+	This diff will not be a part of the commit message.
+
 `-S[<key-id>]`::
 `--gpg-sign[=<key-id>]`::
 `--no-gpg-sign`::
diff --git a/builtin/history.c b/builtin/history.c
index cdb0d30784..e2e0aba4a9 100644
--- a/builtin/history.c
+++ b/builtin/history.c
@@ -3,9 +3,11 @@
 #include "builtin.h"
 #include "advice.h"
 #include "cache-tree.h"
+#include "color.h"
 #include "commit.h"
 #include "commit-reach.h"
 #include "config.h"
+#include "diff.h"
 #include "editor.h"
 #include "environment.h"
 #include "gettext.h"
@@ -34,7 +36,7 @@
 #define GIT_HISTORY_FIXUP_USAGE \
 	N_("git history fixup <commit> [--dry-run] [--update-refs=(branches|head)] [--reedit-message] [--empty=(drop|keep|abort)] [--[no-]gpg-sign[=<key-id>]]")
 #define GIT_HISTORY_REWORD_USAGE \
-	N_("git history reword <commit> [--dry-run] [--update-refs=(branches|head)] [--[no-]gpg-sign[=<key-id>]]")
+	N_("git history reword <commit> [--dry-run] [--update-refs=(branches|head)] [-v | --verbose] [--[no-]gpg-sign[=<key-id>]]")
 #define GIT_HISTORY_SPLIT_USAGE \
 	N_("git history split <commit> [--dry-run] [--update-refs=(branches|head)] [--[no-]gpg-sign[=<key-id>]] [--] [<pathspec>...]")
 #define GIT_HISTORY_SQUASH_USAGE \
@@ -47,11 +49,32 @@ static void change_data_free(void *util, const char *str UNUSED)
 	free(d);
 }
 
+static void print_verbose_diff(struct repository *repo,
+			       const struct object_id *old_tree,
+			       const struct object_id *new_tree,
+			       FILE *fp)
+{
+	struct diff_options opts;
+
+	repo_diff_setup(repo, &opts);
+	opts.output_format = DIFF_FORMAT_PATCH;
+	opts.flags.allow_textconv = 1;
+	opts.use_color = GIT_COLOR_NEVER;
+	opts.file = fp;
+	diff_setup_done(&opts);
+
+	diff_tree_oid(old_tree, new_tree, "", &opts);
+	diffcore_std(&opts);
+	diff_flush(&opts);
+	diff_free(&opts);
+}
+
 static int fill_commit_message(struct repository *repo,
 			       const struct object_id *old_tree,
 			       const struct object_id *new_tree,
 			       const char *default_message,
 			       const char *action,
+			       int verbose,
 			       struct strbuf *out)
 {
 	const char *path = git_path_commit_editmsg();
@@ -84,6 +107,10 @@ static int fill_commit_message(struct repository *repo,
 
 	wt_status_collect_changes_trees(&s, old_tree, new_tree);
 	wt_status_print(&s);
+	if (verbose) {
+		wt_status_add_cut_line(&s);
+		print_verbose_diff(repo, old_tree, new_tree, s.fp);
+	}
 	wt_status_collect_free_buffers(&s);
 	string_list_clear_func(&s.change, change_data_free);
 	if (fclose(s.fp))
@@ -95,7 +122,7 @@ static int fill_commit_message(struct repository *repo,
 		return -1;
 	}
 
-	cleanup_message(out, COMMIT_MSG_CLEANUP_ALL, 0);
+	cleanup_message(out, COMMIT_MSG_CLEANUP_ALL, verbose);
 
 	if (!out->len) {
 		fprintf(stderr, _("Aborting commit due to empty commit message.\n"));
@@ -107,6 +134,7 @@ static int fill_commit_message(struct repository *repo,
 
 enum commit_tree_flags {
 	COMMIT_TREE_EDIT_MESSAGE = (1 << 0),
+	COMMIT_TREE_VERBOSE = (1 << 1),
 };
 
 static int history_config(const char *var, const char *value,
@@ -122,6 +150,19 @@ static int history_config(const char *var, const char *value,
 	return git_default_config(var, value, ctx, NULL);
 }
 
+static int reword_config(const char *var, const char *value,
+			 const struct config_context *ctx, void *data)
+{
+	const char **sign_commit = data;
+
+	if (!strcmp(var, "commit.gpgsign")) {
+		*sign_commit = git_config_bool(var, value) ? "" : NULL;
+		return 0;
+	}
+
+	return git_diff_ui_config(var, value, ctx, NULL);
+}
+
 #define OPT_HISTORY_GPG_SIGN(v) { \
 	.type = OPTION_STRING, \
 	.short_name = 'S', \
@@ -172,7 +213,9 @@ static int commit_tree_ext(struct repository *repo,
 
 	if (flags & COMMIT_TREE_EDIT_MESSAGE) {
 		ret = fill_commit_message(repo, old_tree, new_tree,
-					  message_template, action, &commit_message);
+					  message_template, action,
+					  !!(flags & COMMIT_TREE_VERBOSE),
+					  &commit_message);
 		if (ret < 0)
 			goto out;
 	} else {
@@ -221,6 +264,7 @@ static int commit_tree_with_edited_message(struct repository *repo,
 					   const char *action,
 					   struct commit *original,
 					   const char *sign_commit,
+					   int verbose,
 					   struct commit **out)
 {
 	struct object_id parent_tree_oid;
@@ -233,7 +277,8 @@ static int commit_tree_with_edited_message(struct repository *repo,
 
 	return commit_tree_ext(repo, action, original, NULL, original->parents,
 			       &parent_tree_oid, tree_oid, sign_commit, out,
-			       COMMIT_TREE_EDIT_MESSAGE);
+			       COMMIT_TREE_EDIT_MESSAGE |
+			       (verbose ? COMMIT_TREE_VERBOSE : 0));
 }
 
 enum ref_action {
@@ -754,13 +799,14 @@ static int cmd_history_reword(int argc,
 	};
 	enum ref_action action = REF_ACTION_DEFAULT;
 	const char *sign_commit = NULL;
-	int dry_run = 0;
+	int dry_run = 0, verbose = 0;
 	struct option options[] = {
 		OPT_CALLBACK_F(0, "update-refs", &action, "(branches|head)",
 			       N_("control which refs should be updated"),
 			       PARSE_OPT_NONEG, parse_ref_action),
 		OPT_BOOL('n', "dry-run", &dry_run,
 			 N_("perform a dry-run without updating any refs")),
+		OPT__VERBOSE(&verbose, N_("show diff in commit message")),
 		OPT_HISTORY_GPG_SIGN(&sign_commit),
 		OPT_END(),
 	};
@@ -769,7 +815,7 @@ static int cmd_history_reword(int argc,
 	struct rev_info revs = { 0 };
 	int ret;
 
-	repo_config(repo, history_config, &sign_commit);
+	repo_config(repo, reword_config, &sign_commit);
 	argc = parse_options(argc, argv, prefix, options, usage, 0);
 	if (argc != 1) {
 		ret = error(_("command expects a single revision"));
@@ -790,7 +836,7 @@ static int cmd_history_reword(int argc,
 		goto out;
 
 	ret = commit_tree_with_edited_message(repo, "reworded", original,
-					      sign_commit, &rewritten);
+					      sign_commit, verbose, &rewritten);
 	if (ret < 0) {
 		ret = error(_("failed writing reworded commit"));
 		goto out;
diff --git a/t/t3451-history-reword.sh b/t/t3451-history-reword.sh
index 6dbe2143d3..4ec07fb493 100755
--- a/t/t3451-history-reword.sh
+++ b/t/t3451-history-reword.sh
@@ -16,6 +16,19 @@ reword_with_message () {
 	rm fake-editor.sh message
 }
 
+reword_and_capture () {
+	write_script fake-editor.sh <<-\EOF &&
+	cp "$1" captured &&
+	{
+		echo reworded &&
+		sed -n "/^# -* >8 -*$/,\$p" "$1"
+	} >new-message &&
+	mv new-message "$1"
+	EOF
+	test_set_editor "$(pwd)"/fake-editor.sh &&
+	git history reword "$@"
+}
+
 expect_graph () {
 	cat >expect &&
 	lib_test_cmp_graph --graph --format=%s "$@"
@@ -434,6 +447,90 @@ test_expect_success 'aborts with empty commit message' '
 	)
 '
 
+test_expect_success '--verbose shows the diff of the reworded commit' '
+	test_when_finished "rm -rf repo" &&
+	git init repo &&
+	(
+		cd repo &&
+		test_commit first &&
+		test_commit second &&
+		test_commit third &&
+		echo unstaged >first.t &&
+		echo staged >third.t &&
+		git add third.t &&
+		git show --format= HEAD~ >expect &&
+
+		reword_and_capture --verbose HEAD~ &&
+
+		test_grep "^# -* >8 -*\$" captured &&
+		sed -n "/^diff --git/,\$p" captured >actual &&
+		test_cmp expect actual &&
+
+		test_commit_message HEAD~ <<-\EOF
+		reworded
+		EOF
+	)
+'
+
+test_expect_success 'no diff is shown without --verbose' '
+	test_when_finished "rm -rf repo" &&
+	git init repo &&
+	(
+		cd repo &&
+		test_commit first &&
+
+		test_tick &&
+		reword_and_capture HEAD &&
+		test_grep ! "^diff --git" captured &&
+		test_grep ! ">8" captured &&
+
+		test_tick &&
+		reword_and_capture --verbose --no-verbose HEAD &&
+		test_grep ! "^diff --git" captured &&
+		test_grep ! ">8" captured &&
+
+		test_tick &&
+		git config commit.verbose true &&
+		reword_and_capture HEAD &&
+		test_grep ! "^diff --git" captured &&
+		test_grep ! ">8" captured
+	)
+'
+
+test_expect_success '--verbose works in a bare repository' '
+	test_when_finished "rm -rf repo repo.git" &&
+	git init repo &&
+	test_commit -C repo first &&
+	test_commit -C repo second &&
+	git clone --bare repo repo.git &&
+	(
+		cd repo.git &&
+		reword_and_capture --verbose HEAD~ &&
+		test_grep "^diff --git a/first.t b/first.t\$" captured &&
+		test_commit_message HEAD~ <<-\EOF
+		reworded
+		EOF
+	)
+'
+
+test_expect_success '--verbose on a merge diffs against the first parent' '
+	test_when_finished "rm -rf repo" &&
+	git init repo &&
+	(
+		cd repo &&
+		test_commit base &&
+		git switch -c side &&
+		test_commit theirs &&
+		git switch - &&
+		test_commit ours &&
+		git merge --no-edit side &&
+
+		reword_and_capture --verbose HEAD &&
+		test_grep "^diff --git a/theirs.t b/theirs.t\$" captured &&
+		test_grep ! "^diff --git a/ours.t" captured
+	)
+'
+
 test_expect_success 'retains changes in the worktree and index' '
 	test_when_finished "rm -rf repo" &&
 	git init repo &&
-- 
2.56.0
Phillip Wood· Nov 9, 2026, 10:17 UTC · re: Jelle van der Waa · lore

Re: [RFC PATCH 2/2] history: add --verbose option for reword

Hi Jelle
On 07/11/2026 19:30, Jelle van der Waa wrote:
> When rewording a commit message it is often useful to have context of
> the changes. Indeed - I'm still using a wrapper around "git rebase -i" to reword commits because "git history reword" does not show the diff. Thanks for working on this.
> This commit implements the --verbose option of git commit
> in git history reword with the only difference in that it does not
> folllow the commit.verbose configuration setting.
As it is easy to support commit.verbose, I think we should. In my ideal world we'd default to showing the diff when rewording but that's not really compatible with the way "commit.verbose" works.
Show 10 quoted lines
> diff --git a/Documentation/git-history.adoc b/Documentation/git-history.adoc
> index 1fcc30150a..a476780623 100644
> --- a/Documentation/git-history.adoc
> +++ b/Documentation/git-history.adoc
> @@ -10,7 +10,7 @@ SYNOPSIS
>   [synopsis]
>   git history drop <commit> [--dry-run] [--update-refs=(branches|head)] [--empty=(drop|keep|abort)] [--[no-]gpg-sign[=<key-id>]]
>   git history fixup <commit> [--dry-run] [--update-refs=(branches|head)] [--reedit-message] [--empty=(drop|keep|abort)] [--[no-]gpg-sign[=<key-id>]]
> -git history reword <commit> [--dry-run] [--update-refs=(branches|head)] [--[no-]gpg-sign[=<key-id>]]
> +git history reword <commit> [--dry-run] [--update-refs=(branches|head)] [-v | --verbose] [--[no-]gpg-sign[=<key-id>]]
It is not a new problem, but these lines are getting very long.
Show 10 quoted lines
> diff --git a/builtin/history.c b/builtin/history.c
> index cdb0d30784..e2e0aba4a9 100644
> --- a/builtin/history.c
> +++ b/builtin/history.c
> @@ -34,7 +36,7 @@
>   #define GIT_HISTORY_FIXUP_USAGE \
>   	N_("git history fixup <commit> [--dry-run] [--update-refs=(branches|head)] [--reedit-message] [--empty=(drop|keep|abort)] [--[no-]gpg-sign[=<key-id>]]")
>   #define GIT_HISTORY_REWORD_USAGE \
> -	N_("git history reword <commit> [--dry-run] [--update-refs=(branches|head)] [--[no-]gpg-sign[=<key-id>]]")
> +	N_("git history reword <commit> [--dry-run] [--update-refs=(branches|head)] [-v | --verbose] [--[no-]gpg-sign[=<key-id>]]")
As above, it is not a new problem, but these lines are very long.
>   #define GIT_HISTORY_SPLIT_USAGE \
>   	N_("git history split <commit> [--dry-run] [--update-refs=(branches|head)] [--[no-]gpg-sign[=<key-id>]] [--] [<pathspec>...]")
>   #define GIT_HISTORY_SQUASH_USAGE \
Show 6 quoted lines
>   static int fill_commit_message(struct repository *repo,
>   			       const struct object_id *old_tree,
>   			       const struct object_id *new_tree,
>   			       const char *default_message,
>   			       const char *action,
> +			       int verbose,
If this was a bool, we could get rid of the "!!()" in the caller.
Show 9 quoted lines
>   			       struct strbuf *out)
>   {
>   	const char *path = git_path_commit_editmsg();
> @@ -84,6 +107,10 @@ static int fill_commit_message(struct repository *repo,
>   >   	wt_status_collect_changes_trees(&s, old_tree, new_tree);
>   	wt_status_print(&s);
> +	if (verbose) {
> +		wt_status_add_cut_line(&s);
> +		print_verbose_diff(repo, old_tree, new_tree, s.fp);
We already reuse some of the code in wt-status.c that "git commit" uses to generate the template message, how hard would it be to teach the status code to generate the diff for us as it does for "git commit"? "git commit" also respects status.relativePaths, status.renames and status.renameLimit in addition to the equivalent diff settings - should we be doing the same here?
Show 12 quoted lines
> +static int reword_config(const char *var, const char *value,
> +			 const struct config_context *ctx, void *data)
> +{
> +	const char **sign_commit = data;
> +
> +	if (!strcmp(var, "commit.gpgsign")) {
> +		*sign_commit = git_config_bool(var, value) ? "" : NULL;
> +		return 0;
> +	}
> +
> +	return git_diff_ui_config(var, value, ctx, NULL);
> +}
I'm in two minds about this - it would be simpler to share the same config callback between all subcommands, even if it means we read a bit more config that we really need to for some commands.
Show 13 quoted lines
> diff --git a/t/t3451-history-reword.sh b/t/t3451-history-reword.sh
> index 6dbe2143d3..4ec07fb493 100755
> --- a/t/t3451-history-reword.sh
> +++ b/t/t3451-history-reword.sh
> @@ -16,6 +16,19 @@ reword_with_message () {
>   	rm fake-editor.sh message
>   }
>   > +reword_and_capture () {
> +	write_script fake-editor.sh <<-\EOF &&
> +	cp "$1" captured &&
> +	{
> +		echo reworded &&
> +		sed -n "/^# -* >8 -*$/,\$p" "$1"
We preserve the scissors line and the diff to check the message is cleaned up as we expect - good.
Show 12 quoted lines
> +test_expect_success '--verbose shows the diff of the reworded commit' '
> +	test_when_finished "rm -rf repo" &&
> +	git init repo &&
> +	(
> +		cd repo &&
> +		test_commit first &&
> +		test_commit second &&
> +		test_commit third &&
> +		echo unstaged >first.t &&
> +		echo staged >third.t &&
> +		git add third.t &&
> +		git show --format= HEAD~ >expect &&
This looks a bit strange - if we just want a diff why don't we create it by running "git diff"?
	git diff HEAD~^- >expect
> +
> +		reword_and_capture --verbose HEAD~ &&
> +
> +		test_grep "^# -* >8 -*\$" captured &&
If this line is not in the output then the sed command in the fake editor wont have printed the diff so I'm not sure this actually adds anything.
Show 6 quoted lines
> +		sed -n "/^diff --git/,\$p" captured >actual &&
> +		test_cmp expect actual &&
> +
> +		test_commit_message HEAD~ <<-\EOF
> +		reworded
> +		EOF
We check the diff and the reworded message - good. We do not check that the user sees the original message though - perhaps we'd be better to just compare captured against what we expect the user to see.
> +test_expect_success 'no diff is shown without --verbose' '
Why do we need a separate test to do this, rather than just checking there is no diff in one of the existing tests?
> +test_expect_success '--verbose works in a bare repository' '
I'm not sure this adds much value - we already have a test to check reword works in a bare repository and there is nothing in the implementation of verbose that is conditional on the whether the repository is bare or not. What failure mode do we expect this test to detect that the existing test wont?
> +test_expect_success '--verbose on a merge diffs against the first parent' '
Can we extend the existing test for rewording a merge commit instead of adding a new one? Our test suite is slow and the way the history tests are written makes it even slower because they initialize a new repository and create a bunch of new commits for every single test.
Thanks for working on this - it is a really useful improvement
Phillip
>   test_expect_success 'retains changes in the worktree and index' '
>   	test_when_finished "rm -rf repo" &&
>   	git init repo &&
D. Ben Knoble· Nov 7, 2026, 19:49 UTC · re: Jelle van der Waa · lore

Re: [RFC PATCH 0/2] Support --verbose in git history

On Sat, Nov 7, 2026 at 2:36 PM Jelle van der Waa <jelle@vdwaa.nl> wrote:
Show 6 quoted lines
>
> The new git history subcommands like reword do not support showing the
> full git diff when editing the git commit message. This RFC adds support
> for git history reword behave similiar to git commit --amend --verbose
> except I choose to leave out support the "commit.verbose" configuration
> option.

Just as a first thought, while it is nice to keep the interfaces consistent with each other, I wonder if we want to reserve a different meaning for "verbose" in the context of git-history? For example, I've sometimes wished git-history would show the rewritten commits after execution:

    commit abc => def
    …

Anyway, my point is, there's a lot of possible meanings for "verbose", so maybe we could use "--commit-verbose" (blech), "--diff-in-editor", or some other thing that smarter folks than I will come up with which clearly signals what we're about?

Show 20 quoted lines
> Other git history subcommands like split, squash and fixup could also
> support --verbose under some circumstances (without --no-edit for fixup
> or only with --reedit-message for fixup)
>
> I would be happy to work start with landing support for --verbose for
> git history reword, ideally with it also supporting the "commit.verbose"
> configuration option. Further patches could then add support for other
> subcommands where it makes sense.
>
> Jelle van der Waa (2):
>   history: drop redundant strbuf_stripspace()
>   history: add --verbose option for reword
>
>  Documentation/git-history.adoc | 11 +++-
>  builtin/history.c              | 61 ++++++++++++++++++---
>  t/t3451-history-reword.sh      | 97 ++++++++++++++++++++++++++++++++++
>  3 files changed, 160 insertions(+), 9 deletions(-)
>
> --
> 2.56.0
Thanks for an interesting idea.
-- 
D. Ben Knoble
Phillip Wood· Nov 9, 2026, 10:18 UTC · re: D. Ben Knoble · lore

Re: [RFC PATCH 0/2] Support --verbose in git history

On 07/11/2026 19:49, D. Ben Knoble wrote:
> On Sat, Nov 7, 2026 at 2:36 PM Jelle van der Waa <jelle@vdwaa.nl> wrote:
>>
> > Anyway, my point is, there's a lot of possible meanings for "verbose",
That's a good point
> so maybe we could use "--commit-verbose" (blech), "--diff-in-editor",
> or some other thing that smarter folks than I will come up with which
> clearly signals what we're about?
Off the top of my head --show-diff, though I'm not sure that's any better than your suggestions
>> Other git history subcommands like split, squash and fixup could also
>> support --verbose under some circumstances (without --no-edit for fixup
>> or only with --reedit-message for fixup)
That, and supporting "commit.verbose" is a good idea
Thanks
Phillip
Show 18 quoted lines
>> I would be happy to work start with landing support for --verbose for
>> git history reword, ideally with it also supporting the "commit.verbose"
>> configuration option. Further patches could then add support for other
>> subcommands where it makes sense.
>>
>> Jelle van der Waa (2):
>>    history: drop redundant strbuf_stripspace()
>>    history: add --verbose option for reword
>>
>>   Documentation/git-history.adoc | 11 +++-
>>   builtin/history.c              | 61 ++++++++++++++++++---
>>   t/t3451-history-reword.sh      | 97 ++++++++++++++++++++++++++++++++++
>>   3 files changed, 160 insertions(+), 9 deletions(-)
>>
>> --
>> 2.56.0
> > Thanks for an interesting idea.
> 
Karthik Nayak· Nov 9, 2026, 12:06 UTC · re: Phillip Wood · lore

Re: [RFC PATCH 0/2] Support --verbose in git history

Phillip Wood <phillip.wood123@gmail.com> writes:
Show 15 quoted lines
> On 07/11/2026 19:49, D. Ben Knoble wrote:
>> On Sat, Nov 7, 2026 at 2:36 PM Jelle van der Waa <jelle@vdwaa.nl> wrote:
>>>
>>
>> Anyway, my point is, there's a lot of possible meanings for "verbose",
>
> That's a good point
>
>> so maybe we could use "--commit-verbose" (blech), "--diff-in-editor",
>> or some other thing that smarter folks than I will come up with which
>> clearly signals what we're about?
>
> Off the top of my head --show-diff, though I'm not sure that's any
> better than your suggestions
>

My preference would be to make this (current patch) default behavior and not even have an option. I don't see a disadvantage of having the diff always being shown and it definitely is a better default to have.

D. Ben Knoble· Nov 9, 2026, 12:43 UTC · re: Karthik Nayak · lore

Re: [RFC PATCH 0/2] Support --verbose in git history

On Mon, Nov 9, 2026 at 7:06 AM Karthik Nayak <karthik.188@gmail.com> wrote:
Show 22 quoted lines
>
> Phillip Wood <phillip.wood123@gmail.com> writes:
>
> > On 07/11/2026 19:49, D. Ben Knoble wrote:
> >> On Sat, Nov 7, 2026 at 2:36 PM Jelle van der Waa <jelle@vdwaa.nl> wrote:
> >>>
> >>
> >> Anyway, my point is, there's a lot of possible meanings for "verbose",
> >
> > That's a good point
> >
> >> so maybe we could use "--commit-verbose" (blech), "--diff-in-editor",
> >> or some other thing that smarter folks than I will come up with which
> >> clearly signals what we're about?
> >
> > Off the top of my head --show-diff, though I'm not sure that's any
> > better than your suggestions
> >
>
> My preference would be to make this (current patch) default behavior and
> not even have an option. I don't see a disadvantage of having the diff
> always being shown and it definitely is a better default to have.

When the diff is extremely long, or if the user has other means of obtaining it and wants the editor to open quickly, it may not be desired. So I'd prefer to still have it optional, personally.

-- 
D. Ben Knoble
Phillip Wood· Nov 9, 2026, 14:14 UTC · re: D. Ben Knoble · lore

Re: [RFC PATCH 0/2] Support --verbose in git history

On 09/11/2026 12:43, D. Ben Knoble wrote:
Show 8 quoted lines
> On Mon, Nov 9, 2026 at 7:06 AM Karthik Nayak <karthik.188@gmail.com> wrote:
>>
>> My preference would be to make this (current patch) default behavior and
>> not even have an option. I don't see a disadvantage of having the diff
>> always being shown and it definitely is a better default to have.
> > When the diff is extremely long, or if the user has other means of
> obtaining it and wants the editor to open quickly, it may not be
> desired. So I'd prefer to still have it optional, personally.
Another case where we might not want the diff is scripted editing as it is much easier if the script does not have to worry about the diff getting in the way of its edits. Personally I'd be happy to see this on by default - the history command is marked as experimental so if having it on by default rather than following "commit.verbose" proves to be problematic we can always change it in the future. If we were staring again I'd also make "commit.verbose" on by default as well so maybe I'm biased.
Thanks
Phillip
Karthik Nayak· Nov 10, 2026, 13:13 UTC · re: Phillip Wood · lore

Re: [RFC PATCH 0/2] Support --verbose in git history

Phillip Wood <phillip.wood123@gmail.com> writes:
Show 23 quoted lines
> On 09/11/2026 12:43, D. Ben Knoble wrote:
>> On Mon, Nov 9, 2026 at 7:06 AM Karthik Nayak <karthik.188@gmail.com> wrote:
>>>
>>> My preference would be to make this (current patch) default behavior and
>>> not even have an option. I don't see a disadvantage of having the diff
>>> always being shown and it definitely is a better default to have.
>>
>> When the diff is extremely long, or if the user has other means of
>> obtaining it and wants the editor to open quickly, it may not be
>> desired. So I'd prefer to still have it optional, personally.
>
> Another case where we might not want the diff is scripted editing as it
> is much easier if the script does not have to worry about the diff
> getting in the way of its edits. Personally I'd be happy to see this on
> by default - the history command is marked as experimental so if having
> it on by default rather than following "commit.verbose" proves to be
> problematic we can always change it in the future. If we were staring
> again I'd also make "commit.verbose" on by default as well so maybe I'm
> biased.
>
> Thanks
>
> Phillip

I'm on board with this suggestion. Plus, I see 'git history' to be more user facing and it's always nicer to have better defaults for users. Showing diffs and verbose information seems to be inline with that. We could add an option to disable such output for scripts (but that can be done later as you suggested).

Ben Knoble· Nov 10, 2026, 17:15 UTC · re: Karthik Nayak · lore

Re: [RFC PATCH 0/2] Support --verbose in git history

Show 34 quoted lines
> Le 10 nov. 2026 à 08:13, Karthik Nayak <karthik.188@gmail.com> a écrit :
> 
> Phillip Wood <phillip.wood123@gmail.com> writes:
> 
>>> On 09/11/2026 12:43, D. Ben Knoble wrote:
>>> On Mon, Nov 9, 2026 at 7:06 AM Karthik Nayak <karthik.188@gmail.com> wrote:
>>>> 
>>>> My preference would be to make this (current patch) default behavior and
>>>> not even have an option. I don't see a disadvantage of having the diff
>>>> always being shown and it definitely is a better default to have.
>>> 
>>> When the diff is extremely long, or if the user has other means of
>>> obtaining it and wants the editor to open quickly, it may not be
>>> desired. So I'd prefer to still have it optional, personally.
>> 
>> Another case where we might not want the diff is scripted editing as it
>> is much easier if the script does not have to worry about the diff
>> getting in the way of its edits. Personally I'd be happy to see this on
>> by default - the history command is marked as experimental so if having
>> it on by default rather than following "commit.verbose" proves to be
>> problematic we can always change it in the future. If we were staring
>> again I'd also make "commit.verbose" on by default as well so maybe I'm
>> biased.
>> 
>> Thanks
>> 
>> Phillip
> 
> I'm on board with this suggestion. Plus, I see 'git history' to be more
> user facing and it's always nicer to have better defaults for users.
> Showing diffs and verbose information seems to be inline with that. We
> could add an option to disable such output for scripts (but that can be
> done later as you suggested).
> <signature.asc>
I can live with opt-out as long as I can turn it off via config.
Patrick Steinhardt· Nov 11, 2026, 10:46 UTC · re: Ben Knoble · lore

Re: [RFC PATCH 0/2] Support --verbose in git history

On Tue, Nov 10, 2026 at 12:15:20PM -0500, Ben Knoble wrote:
Show 38 quoted lines
> 
> 
> > Le 10 nov. 2026 à 08:13, Karthik Nayak <karthik.188@gmail.com> a écrit :
> > 
> > Phillip Wood <phillip.wood123@gmail.com> writes:
> > 
> >>> On 09/11/2026 12:43, D. Ben Knoble wrote:
> >>> On Mon, Nov 9, 2026 at 7:06 AM Karthik Nayak <karthik.188@gmail.com> wrote:
> >>>> 
> >>>> My preference would be to make this (current patch) default behavior and
> >>>> not even have an option. I don't see a disadvantage of having the diff
> >>>> always being shown and it definitely is a better default to have.
> >>> 
> >>> When the diff is extremely long, or if the user has other means of
> >>> obtaining it and wants the editor to open quickly, it may not be
> >>> desired. So I'd prefer to still have it optional, personally.
> >> 
> >> Another case where we might not want the diff is scripted editing as it
> >> is much easier if the script does not have to worry about the diff
> >> getting in the way of its edits. Personally I'd be happy to see this on
> >> by default - the history command is marked as experimental so if having
> >> it on by default rather than following "commit.verbose" proves to be
> >> problematic we can always change it in the future. If we were staring
> >> again I'd also make "commit.verbose" on by default as well so maybe I'm
> >> biased.
> >> 
> >> Thanks
> >> 
> >> Phillip
> > 
> > I'm on board with this suggestion. Plus, I see 'git history' to be more
> > user facing and it's always nicer to have better defaults for users.
> > Showing diffs and verbose information seems to be inline with that. We
> > could add an option to disable such output for scripts (but that can be
> > done later as you suggested).
> > <signature.asc>
> 
> I can live with opt-out as long as I can turn it off via config.

Yeah, agreed. For me there's two important parts, where being able to disable this is the first one. The second part is that we need to make sure that such a format can work for every subcommand of git-history(1) so that we don't have to have multiple different formats for it.

Patrick
Phillip Wood· Nov 11, 2026, 13:57 UTC · re: Patrick Steinhardt · lore

Re: [RFC PATCH 0/2] Support --verbose in git history

Hi Patrick
On 11/11/2026 10:46, Patrick Steinhardt wrote:
Show 25 quoted lines
> On Tue, Nov 10, 2026 at 12:15:20PM -0500, Ben Knoble wrote:
>>> Le 10 nov. 2026 à 08:13, Karthik Nayak <karthik.188@gmail.com> a écrit :
>>> Phillip Wood <phillip.wood123@gmail.com> writes:
>>>>
>>>> Another case where we might not want the diff is scripted editing as it
>>>> is much easier if the script does not have to worry about the diff
>>>> getting in the way of its edits. Personally I'd be happy to see this on
>>>> by default - the history command is marked as experimental so if having
>>>> it on by default rather than following "commit.verbose" proves to be
>>>> problematic we can always change it in the future. If we were staring
>>>> again I'd also make "commit.verbose" on by default as well so maybe I'm
>>>> biased.
>>>>
>>> I'm on board with this suggestion. Plus, I see 'git history' to be more
>>> user facing and it's always nicer to have better defaults for users.
>>> Showing diffs and verbose information seems to be inline with that. We
>>> could add an option to disable such output for scripts (but that can be
>>> done later as you suggested).
>>> <signature.asc>
>>
>> I can live with opt-out as long as I can turn it off via config.
> > Yeah, agreed. For me there's two important parts, where being able to
> disable this is the first one. The second part is that we need to make
> sure that such a format can work for every subcommand of git-history(1)
> so that we don't have to have multiple different formats for it.
Can I just check what you mean by "format" please. It is not clear if that refers to the option name, or the way the diff is presented in the message template (or both?).
Thanks
Phillip
Patrick Steinhardt· Nov 11, 2026, 14:03 UTC · re: Phillip Wood · lore

Re: [RFC PATCH 0/2] Support --verbose in git history

On Wed, Nov 11, 2026 at 01:57:46PM +0000, Phillip Wood wrote:
Show 33 quoted lines
> Hi Patrick
> 
> On 11/11/2026 10:46, Patrick Steinhardt wrote:
> > On Tue, Nov 10, 2026 at 12:15:20PM -0500, Ben Knoble wrote:
> > > > Le 10 nov. 2026 à 08:13, Karthik Nayak <karthik.188@gmail.com> a écrit :
> > > > Phillip Wood <phillip.wood123@gmail.com> writes:
> > > > > 
> > > > > Another case where we might not want the diff is scripted editing as it
> > > > > is much easier if the script does not have to worry about the diff
> > > > > getting in the way of its edits. Personally I'd be happy to see this on
> > > > > by default - the history command is marked as experimental so if having
> > > > > it on by default rather than following "commit.verbose" proves to be
> > > > > problematic we can always change it in the future. If we were staring
> > > > > again I'd also make "commit.verbose" on by default as well so maybe I'm
> > > > > biased.
> > > > > 
> > > > I'm on board with this suggestion. Plus, I see 'git history' to be more
> > > > user facing and it's always nicer to have better defaults for users.
> > > > Showing diffs and verbose information seems to be inline with that. We
> > > > could add an option to disable such output for scripts (but that can be
> > > > done later as you suggested).
> > > > <signature.asc>
> > > 
> > > I can live with opt-out as long as I can turn it off via config.
> > 
> > Yeah, agreed. For me there's two important parts, where being able to
> > disable this is the first one. The second part is that we need to make
> > sure that such a format can work for every subcommand of git-history(1)
> > so that we don't have to have multiple different formats for it.
> 
> Can I just check what you mean by "format" please. It is not clear if that
> refers to the option name, or the way the diff is presented in the message
> template (or both?).

Both probably, but what I meant is the output format. So it would need to be able to cover:

  - Changes to the commit layout (e.g. `git history split`).
  - Changes to the commit order (a future `git history move`).
  - Changes to the commit message.
  - Updates to multiple references.

I don't think we need to have everything implemented in a first iteration. But the output format should be flexible enough to display these kinds of changes.

To me it almost feels like what we want is essentially the format used by git-range-diff(1).

Patrick
Ben Knoble· Nov 11, 2026, 15:39 UTC · re: Patrick Steinhardt · lore

Re: [RFC PATCH 0/2] Support --verbose in git history

Show 56 quoted lines
> Le 11 nov. 2026 à 09:03, Patrick Steinhardt <ps@pks.im> a écrit :
> 
> On Wed, Nov 11, 2026 at 01:57:46PM +0000, Phillip Wood wrote:
>> Hi Patrick
>> 
>>> On 11/11/2026 10:46, Patrick Steinhardt wrote:
>>> On Tue, Nov 10, 2026 at 12:15:20PM -0500, Ben Knoble wrote:
>>>>> Le 10 nov. 2026 à 08:13, Karthik Nayak <karthik.188@gmail.com> a écrit :
>>>>> Phillip Wood <phillip.wood123@gmail.com> writes:
>>>>>> 
>>>>>> Another case where we might not want the diff is scripted editing as it
>>>>>> is much easier if the script does not have to worry about the diff
>>>>>> getting in the way of its edits. Personally I'd be happy to see this on
>>>>>> by default - the history command is marked as experimental so if having
>>>>>> it on by default rather than following "commit.verbose" proves to be
>>>>>> problematic we can always change it in the future. If we were staring
>>>>>> again I'd also make "commit.verbose" on by default as well so maybe I'm
>>>>>> biased.
>>>>>> 
>>>>> I'm on board with this suggestion. Plus, I see 'git history' to be more
>>>>> user facing and it's always nicer to have better defaults for users.
>>>>> Showing diffs and verbose information seems to be inline with that. We
>>>>> could add an option to disable such output for scripts (but that can be
>>>>> done later as you suggested).
>>>>> <signature.asc>
>>>> 
>>>> I can live with opt-out as long as I can turn it off via config.
>>> 
>>> Yeah, agreed. For me there's two important parts, where being able to
>>> disable this is the first one. The second part is that we need to make
>>> sure that such a format can work for every subcommand of git-history(1)
>>> so that we don't have to have multiple different formats for it.
>> 
>> Can I just check what you mean by "format" please. It is not clear if that
>> refers to the option name, or the way the diff is presented in the message
>> template (or both?).
> 
> Both probably, but what I meant is the output format. So it would need
> to be able to cover:
> 
>  - Changes to the commit layout (e.g. `git history split`).
> 
>  - Changes to the commit order (a future `git history move`).
> 
>  - Changes to the commit message.
> 
>  - Updates to multiple references.
> 
> I don't think we need to have everything implemented in a first
> iteration. But the output format should be flexible enough to display
> these kinds of changes.
> 
> To me it almost feels like what we want is essentially the format used
> by git-range-diff(1).
> 
> Patrick

Interesting; I certainly would appreciate range-diff-like content *somewhere* when using git-history. The original proposal was more like commit’s verbose diff in the editor, though, and I can see a desire to have that in all of the supported subcommands, too (maybe just as a reminder).

Decisions, decisions…
Patrick Steinhardt· Nov 11, 2026, 16:07 UTC · re: Ben Knoble · lore

Re: [RFC PATCH 0/2] Support --verbose in git history

On Wed, Nov 11, 2026 at 10:39:51AM -0500, Ben Knoble wrote:
Show 62 quoted lines
> 
> > Le 11 nov. 2026 à 09:03, Patrick Steinhardt <ps@pks.im> a écrit :
> > 
> > On Wed, Nov 11, 2026 at 01:57:46PM +0000, Phillip Wood wrote:
> >> Hi Patrick
> >> 
> >>> On 11/11/2026 10:46, Patrick Steinhardt wrote:
> >>> On Tue, Nov 10, 2026 at 12:15:20PM -0500, Ben Knoble wrote:
> >>>>> Le 10 nov. 2026 à 08:13, Karthik Nayak <karthik.188@gmail.com> a écrit :
> >>>>> Phillip Wood <phillip.wood123@gmail.com> writes:
> >>>>>> 
> >>>>>> Another case where we might not want the diff is scripted editing as it
> >>>>>> is much easier if the script does not have to worry about the diff
> >>>>>> getting in the way of its edits. Personally I'd be happy to see this on
> >>>>>> by default - the history command is marked as experimental so if having
> >>>>>> it on by default rather than following "commit.verbose" proves to be
> >>>>>> problematic we can always change it in the future. If we were staring
> >>>>>> again I'd also make "commit.verbose" on by default as well so maybe I'm
> >>>>>> biased.
> >>>>>> 
> >>>>> I'm on board with this suggestion. Plus, I see 'git history' to be more
> >>>>> user facing and it's always nicer to have better defaults for users.
> >>>>> Showing diffs and verbose information seems to be inline with that. We
> >>>>> could add an option to disable such output for scripts (but that can be
> >>>>> done later as you suggested).
> >>>>> <signature.asc>
> >>>> 
> >>>> I can live with opt-out as long as I can turn it off via config.
> >>> 
> >>> Yeah, agreed. For me there's two important parts, where being able to
> >>> disable this is the first one. The second part is that we need to make
> >>> sure that such a format can work for every subcommand of git-history(1)
> >>> so that we don't have to have multiple different formats for it.
> >> 
> >> Can I just check what you mean by "format" please. It is not clear if that
> >> refers to the option name, or the way the diff is presented in the message
> >> template (or both?).
> > 
> > Both probably, but what I meant is the output format. So it would need
> > to be able to cover:
> > 
> >  - Changes to the commit layout (e.g. `git history split`).
> > 
> >  - Changes to the commit order (a future `git history move`).
> > 
> >  - Changes to the commit message.
> > 
> >  - Updates to multiple references.
> > 
> > I don't think we need to have everything implemented in a first
> > iteration. But the output format should be flexible enough to display
> > these kinds of changes.
> > 
> > To me it almost feels like what we want is essentially the format used
> > by git-range-diff(1).
> > 
> > Patrick
> 
> Interesting; I certainly would appreciate range-diff-like content *somewhere*
> when using git-history. The original proposal was more like commit’s
> verbose diff in the editor, though, and I can see a desire to have that
> in all of the supported subcommands, too (maybe just as a reminder).
Oh, right. Shouldn't be posting on the mailing with a headache, I guess.
Patrick
Jelle van der Waa· Nov 16, 2026, 19:23 UTC · re: Ben Knoble · lore

Re: [RFC PATCH 0/2] Support --verbose in git history

On 11/10/26 18:15, Ben Knoble wrote:
Show 35 quoted lines
> > >> Le 10 nov. 2026 à 08:13, Karthik Nayak <karthik.188@gmail.com> a écrit :
>>
>> Phillip Wood <phillip.wood123@gmail.com> writes:
>>
>>>> On 09/11/2026 12:43, D. Ben Knoble wrote:
>>>> On Mon, Nov 9, 2026 at 7:06 AM Karthik Nayak <karthik.188@gmail.com> wrote:
>>>>>
>>>>> My preference would be to make this (current patch) default behavior and
>>>>> not even have an option. I don't see a disadvantage of having the diff
>>>>> always being shown and it definitely is a better default to have.
>>>>
>>>> When the diff is extremely long, or if the user has other means of
>>>> obtaining it and wants the editor to open quickly, it may not be
>>>> desired. So I'd prefer to still have it optional, personally.
>>>
>>> Another case where we might not want the diff is scripted editing as it
>>> is much easier if the script does not have to worry about the diff
>>> getting in the way of its edits. Personally I'd be happy to see this on
>>> by default - the history command is marked as experimental so if having
>>> it on by default rather than following "commit.verbose" proves to be
>>> problematic we can always change it in the future. If we were staring
>>> again I'd also make "commit.verbose" on by default as well so maybe I'm
>>> biased.
>>>
>>> Thanks
>>>
>>> Phillip
>>
>> I'm on board with this suggestion. Plus, I see 'git history' to be more
>> user facing and it's always nicer to have better defaults for users.
>> Showing diffs and verbose information seems to be inline with that. We
>> could add an option to disable such output for scripts (but that can be
>> done later as you suggested).
>> <signature.asc>
> > I can live with opt-out as long as I can turn it off via config.

It seems most of the replies agree that "verbose" should be the default with a means to opt-out. git history split, reword and fixup would turn this on (as drop does not have an way to interact with a commit message).

I'll spin up a new patch which will drop the --verbose option and make "verbose" follow commit.verbose and make it the default for git history.
Thanks for all the feedback,
Jelle van der Waa
Ben Knoble· Nov 17, 2026, 02:33 UTC · re: Jelle van der Waa · lore

Re: [RFC PATCH 0/2] Support --verbose in git history

> Le 16 nov. 2026 à 14:23, Jelle van der Waa <jelle@vdwaa.nl> a écrit :
> I'll spin up a new patch which will drop the --verbose option and make "verbose" follow commit.verbose and make it the default for git history.

Even with a config setting, we’d still want a CLI option to behave deterministically for interactive use (or for scripts), no?

Junio C Hamano· Nov 17, 2026, 03:29 UTC · re: Ben Knoble · lore

Re: [RFC PATCH 0/2] Support --verbose in git history

Ben Knoble <ben.knoble@gmail.com> writes:
Show 7 quoted lines
>> Le 16 nov. 2026 à 14:23, Jelle van der Waa <jelle@vdwaa.nl> a écrit :
>
>
>> I'll spin up a new patch which will drop the --verbose option and make "verbose" follow commit.verbose and make it the default for git history.
>
> Even with a config setting, we’d still want a CLI option to behave
> deterministically for interactive use (or for scripts), no?
Absolutely.  Also, isn't the opposite of '--verbose' '--quiet'?
Or OPT__VERBOSITY()?

← back to recent threads