Thread View: linux.kernel.git
14 messages
14 total messages
Started by Jelle van der Waa
Sat, 07 Nov 2026 19:30
[RFC PATCH 0/2] Support --verbose in git history
Author: Jelle van der Waa
Date: Sat, 07 Nov 2026 19:30
Date: Sat, 07 Nov 2026 19:30
26 lines
9484 bytes
9484 bytes
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
[RFC PATCH 1/2] history: drop redundant strbuf_stripspace()
Author: Jelle van der Waa
Date: Sat, 07 Nov 2026 19:30
Date: Sat, 07 Nov 2026 19:30
23 lines
9180 bytes
9180 bytes
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(-)
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
[RFC PATCH 2/2] history: add --verbose option for reword
Author: Jelle van der Waa
Date: Sat, 07 Nov 2026 19:30
Date: Sat, 07 Nov 2026 19:30
328 lines
19515 bytes
19515 bytes
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(-)
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
Re: [RFC PATCH 0/2] Support --verbose in git history
Author: "D. Ben Knoble"
Date: Sat, 07 Nov 2026 19:49
Date: Sat, 07 Nov 2026 19:49
49 lines
13738 bytes
13738 bytes
On Sat, Nov 7, 2026 at 2:36 PM Jelle van der Waa <jelle@vdwaa.nl> wrote:
>
> 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?
> 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
Re: [RFC PATCH 2/2] history: add --verbose option for reword
Author: Phillip Wood
Date: Mon, 09 Nov 2026 10:17
Date: Mon, 09 Nov 2026 10:17
175 lines
18141 bytes
18141 bytes
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.
> 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.
> 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 \
> 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.
> 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?
> +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.
> 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.
> +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.
> + 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 &&
Re: [RFC PATCH 0/2] Support --verbose in git history
Author: Phillip Wood
Date: Mon, 09 Nov 2026 10:18
Date: Mon, 09 Nov 2026 10:18
45 lines
12601 bytes
12601 bytes
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 >> 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. >
Re: [RFC PATCH 0/2] Support --verbose in git history
Author: "D. Ben Knoble"
Date: Mon, 09 Nov 2026 12:43
Date: Mon, 09 Nov 2026 12:43
33 lines
13455 bytes
13455 bytes
On Mon, Nov 9, 2026 at 7:06 AM Karthik Nayak <karthik.188@gmail.com> wrote: > > 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
Re: [RFC PATCH 0/2] Support --verbose in git history
Author: Phillip Wood
Date: Mon, 09 Nov 2026 14:14
Date: Mon, 09 Nov 2026 14:14
24 lines
12284 bytes
12284 bytes
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
Re: [RFC PATCH 0/2] Support --verbose in git history
Author: Karthik Nayak
Date: Tue, 10 Nov 2026 13:13
Date: Tue, 10 Nov 2026 13:13
59 lines
15101 bytes
15101 bytes
--00000000000017a040065febd9fe Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable 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=E2=80=AFAM Karthik Nayak <karthik.188@gmail.= com> wrote: >>> >>> My preference would be to make this (current patch) default behavior an= d >>> 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). --00000000000017a040065febd9fe Content-Type: application/pgp-signature; name="signature.asc" Content-Disposition: attachment; filename="signature.asc" Content-Transfer-Encoding: base64 X-Attachment-Id: b5cee77f626e62f8_0.1 LS0tLS1CRUdJTiBQR1AgU0lHTkFUVVJFLS0tLS0KCmlRSEtCQUVCQ2dBMEZpRUVWODVNZjJOMWNR L0xaY1lHUHRXZkpJNUdqSDhGQW1yekdJVVdIR3RoY25Sb2FXc3UKTVRnNFFHZHRZV2xzTG1OdmJR QUtDUkErMVo4a2prYU1mNmhKREFDQ1VLVE9YS0h4VGJJZVNRaSs0ZFJRV0xkUQoxck1ETXVML3E2 Mk1GRDVDZW1xZEE5S2pCb1lLNUM5eXNES1MwQTE4aGNvT29URHNveTFWRkxqMmxVVDcwMGkvCjF4 R0I0NC9MdDZkZkp0akxUcm5CNzEvUTE1eWhLaXpvUmhnNGJJK0ZwMlVPNkVIU0RmVDFpalFrbFNQ YnRYNnkKMGpWWUFFc2lOMmhVRytvcC9USGdYWk1UZDZscnpibGF4NFpzbkFOY2xhWjZFTTNjVkpq aFphUjFBSGRsZWJTZApra2s0RklLdG84bXZkdUMvWHoxcHFzVHIyeXR1VVQrb3hNQXJmbll4Zm1P ZWdBZ3NlTkVjQVpROWpmZ0pvZlltClIySUpmRUd0QzQ2c2JsUkVyZ1FIeFAxampJU0sxckRHakg2 akJzQitjTXVvNnhlVVpKdmxsdUZpVVBjL2F5Z3kKTUpLMmpqMmZ2UlY0RkZNVHJJTUFTMUVOcTZW QWdsM2xWdjFNWExsVnVCekNuN2R6Y282OTZOUFNkM1c1ZWEvUwpPSEVrUmZzc0I1bTQ1MGhtVnV3 QjI1TDVqRysvU1VvZE9ZdWhtdDFwQUlENzNJRjJsZ3g1b01VOUN0Y3NtU0xuCkY0VUUvV2h1UzQ2 d0pxMTJhV3E5RjZRSUZWbE1icUZRanNFZENoVT0KPW4xQncKLS0tLS1FTkQgUEdQIFNJR05BVFVS RS0tLS0t --00000000000017a040065febd9fe--
Re: [RFC PATCH 0/2] Support --verbose in git history
Author: Ben Knoble
Date: Tue, 10 Nov 2026 17:15
Date: Tue, 10 Nov 2026 17:15
42 lines
12989 bytes
12989 bytes
> 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.
Re: [RFC PATCH 0/2] Support --verbose in git history
Author: Phillip Wood
Date: Wed, 11 Nov 2026 13:57
Date: Wed, 11 Nov 2026 13:57
38 lines
12647 bytes
12647 bytes
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?). Thanks Phillip
Re: [RFC PATCH 0/2] Support --verbose in git history
Author: Jelle van der Waa
Date: Mon, 16 Nov 2026 19:23
Date: Mon, 16 Nov 2026 19:23
52 lines
17013 bytes
17013 bytes
On 11/10/26 18:15, Ben Knoble wrote: > > >> 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
Re: [RFC PATCH 0/2] Support --verbose in git history
Author: Ben Knoble
Date: Tue, 17 Nov 2026 02:33
Date: Tue, 17 Nov 2026 02:33
11 lines
11497 bytes
11497 bytes
> 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?
Re: [RFC PATCH 0/2] Support --verbose in git history
Author: Junio C Hamano
Date: Tue, 17 Nov 2026 03:29
Date: Tue, 17 Nov 2026 03:29
14 lines
13419 bytes
13419 bytes
Ben Knoble <ben.knoble@gmail.com> writes: >> 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()?
Thread Navigation
This is a paginated view of messages in the thread with full content displayed inline.
Messages are displayed in chronological order, with the original post highlighted in green.
Use pagination controls to navigate through all messages in large threads.
Back to All Threads