git/list[1] front-page[2] threads[3] people[4] search[5] about
 

[PATCH RFC v2 00/16] Introduce git-history(1) command for easy history editing

From
Patrick Steinhardt <ps@pks.im>
Date
Aug 24, 2025, 17:42 UTC
Message-ID
<20250824-b4-pks-history-builtin-v2-0-964ac12f65bd@pks.im>
In-Reply-To
<20250819-b4-pks-history-builtin-v1-0-9b77c32688fe@pks.im>
Hi,

over recent months I've been playing around with Jujutsu quite frequently. While I still prefer using Git, there's been a couple features in it that I really like and that I'd like to have in Git, as well.

A copule of these features relate to history editing. Most importantly, I really dig the following commands:

  - jj-abandon(1) to drop a specific commit from your history.
  - jj-absorb(1) to take some changes and automatically apply them to
    commits in your history that last modified the respective hunks.
  - jj-split(1) to split a commit into two.
  - jj-new(1) to insert a new commit after or before a specific other
    commit.

Not all of these commands can be ported directly into Git. jj-new(1) for example doesn't really make a ton of sense for us, I'd claim. But some of these commands _do_ make sense.

I thus had a look at implementing some of these commands in Git itself, where the result is this patch series. Specifically, the following commands are introduced by this patch series:

  - `git history drop` to drop a specific commit. This is basically the
    same as jj-abandon(1).
  - `git history reorder` to reorder a specific commit before or after
    another commit. This is inspired by jj-new(1).
  - `git history split` takes a commit and splits it into two. This is
    basically the same as jj-split(1).

If this is something we want to have I think it'd be just a starting point. There's other commands that I think are quite common and that might make sense to introduce eventually:

  - An equivalent to jj-absorb(1) would be awesome to have.
  - `git history reword` to change only the commit message of a specific
    commit.
  - `git history squash` to squash together multiple commits into one.

In the end, I'd like us to learn from what people like about Jujutsu and apply those learnings to Git. We won't be able to apply all learnings from Jujutsu, as the workflow is quite different there due to the lack of the index. But other things we certainly can apply to Git directly.

Note: This patch series currently builds on the cherry-pick infra.
As such, when one hits a merge conflict one needs to `git cherry-pick
--continue`, which is quite suboptimal. I didn't want to overpolish this
series before getting some feedback, but it is something I'll fix in
subsequent versions. Furthermore, the command for now bails out in the
case where there's any merge commits in the history that is being
rewritten. This is another restriction that can be lifted in the future.
Changes in v2:
  - Add a new "reword" subcommand.
  - List git-history(1) in "command-list.txt".
  - Add some missing error handling.
  - Simplify calling convention of `apply_commits()` to handle root
    commits internally instead of requiring every caller to do so.
  - Add tests to verify that git-history(1) refuses to work with changes
    in the worktree or index.
  - Mark git-history(1) as experimental.
  - Introduce commands to manage interrupted history edits.
  - A bunch of improvements to the manpage.
  - Link to v1: https://lore.kernel.org/r/20250819-b4-pks-history-builtin-v1-0-9b77c32688fe@pks.im
Thanks!
Patrick
---
Patrick Steinhardt (16):
      sequencer: optionally skip printing commit summary
      sequencer: add option to rewind HEAD after picking commits
      sequencer: introduce new history editing mode
      sequencer: stop using `the_repository` in `sequencer_remove_state()`
      cache-tree: allow writing in-memory index as tree
      builtin: add new "history" command
      builtin/history: introduce subcommands to manage interrupted rewrites
      builtin/history: implement "drop" subcommand
      builtin/history: implement "reorder" subcommand
      add-patch: split out header from "add-interactive.h"
      add-patch: split out `struct interactive_options`
      add-patch: remove dependency on "add-interactive" subsystem
      add-patch: add support for in-memory index patching
      wt-status: provide function to expose status for trees
      builtin/history: implement "split" subcommand
      builtin/history: implement "reword" subcommand
 .gitignore                     |   1 +
 Documentation/git-history.adoc | 188 +++++++++
 Documentation/meson.build      |   1 +
 Makefile                       |   1 +
 add-interactive.c              | 151 ++-----
 add-interactive.h              |  43 +-
 add-patch.c                    | 270 ++++++++++--
 add-patch.h                    |  61 +++
 builtin.h                      |   1 +
 builtin/add.c                  |  22 +-
 builtin/checkout.c             |   7 +-
 builtin/commit.c               |  16 +-
 builtin/history.c              | 932 +++++++++++++++++++++++++++++++++++++++++
 builtin/rebase.c               |   4 +-
 builtin/reset.c                |  16 +-
 builtin/revert.c               |   2 +-
 builtin/stash.c                |  46 +-
 cache-tree.c                   |   5 +-
 cache-tree.h                   |   3 +-
 command-list.txt               |   1 +
 commit.h                       |   2 +-
 git.c                          |   1 +
 meson.build                    |   1 +
 sequencer.c                    | 187 +++++++--
 sequencer.h                    |   9 +-
 t/meson.build                  |   7 +-
 t/t3450-history.sh             |  42 ++
 t/t3451-history-drop.sh        | 174 ++++++++
 t/t3452-history-reorder.sh     | 234 +++++++++++
 t/t3453-history-split.sh       | 387 +++++++++++++++++
 t/t3454-history-reword.sh      | 158 +++++++
 wt-status.c                    |  24 ++
 wt-status.h                    |   3 +
 33 files changed, 2714 insertions(+), 286 deletions(-)
Range-diff versus v1:
 1:  c1ce1b2e20 =  1:  6348d1ff69 sequencer: optionally skip printing commit summary
 2:  969d896da1 !  2:  d70cb727bc sequencer: add option to rewind HEAD after picking commits
    @@ sequencer.c: static int pick_commits(struct repository *r,
      	/*
      	 * Sequence of picks finished successfully; cleanup by
      	 * removing the .git/sequencer directory
    +@@ sequencer.c: int sequencer_pick_revisions(struct repository *r,
    + 	if (opts->revs->cmdline.nr == 1 &&
    + 	    opts->revs->cmdline.rev->whence == REV_CMD_REV &&
    + 	    opts->revs->no_walk &&
    +-	    !opts->revs->cmdline.rev->flags) {
    ++	    !opts->revs->cmdline.rev->flags &&
    ++	    !opts->restore_head_target) {
    + 		struct commit *cmit;
    + 
    + 		if (prepare_revision_walk(opts->revs)) {
     
      ## sequencer.h ##
     @@ sequencer.h: struct replay_opts {
 -:  ---------- >  3:  9717385fba sequencer: introduce new history editing mode
 -:  ---------- >  4:  360e5cf08f sequencer: stop using `the_repository` in `sequencer_remove_state()`
 3:  658cff279e =  5:  74be65b8f6 cache-tree: allow writing in-memory index as tree
 4:  886ea1e088 !  6:  a84728f097 builtin: add new "history" command
    @@ Documentation/git-history.adoc (new)
     +
     +NAME
     +----
    -+git-history - Rewrite history of the current branch
    ++git-history - EXPERIMENTAL: Rewrite history of the current branch
     +
     +SYNOPSIS
     +--------
    @@ Documentation/git-history.adoc (new)
     +merges. You should use linkgit:git-rebase[1] with the `--rebase-merges`
     +flag instead.
     +
    ++THIS COMMAND IS EXPERIMENTAL. THE BEHAVIOR MAY CHANGE.
    ++
     +COMMANDS
     +--------
     +
     +This command requires a subcommand. Several subcommands are available to
    -+rewrite history in different ways.
    ++rewrite history in different ways:
     +
     +CONFIGURATION
     +-------------
    @@ builtin/history.c (new)
     +	return 0;
     +}
     
    + ## command-list.txt ##
    +@@ command-list.txt: git-grep                                mainporcelain           info
    + git-gui                                 mainporcelain
    + git-hash-object                         plumbingmanipulators
    + git-help                                ancillaryinterrogators          complete
    ++git-history                             mainporcelain           history
    + git-hook                                purehelpers
    + git-http-backend                        synchingrepositories
    + git-http-fetch                          synchelpers
    +
      ## git.c ##
     @@ git.c: static struct cmd_struct commands[] = {
      	{ "grep", cmd_grep, RUN_SETUP_GENTLY },
 -:  ---------- >  7:  234ad69878 builtin/history: introduce subcommands to manage interrupted rewrites
 5:  084312482f !  8:  a81669a4d1 builtin/history: implement "drop" subcommand
    @@ Commit message
         Signed-off-by: Patrick Steinhardt <ps@pks.im>
     
      ## Documentation/git-history.adoc ##
    -@@ Documentation/git-history.adoc: git-history - Rewrite history of the current branch
    - SYNOPSIS
    - --------
    - [synopsis]
    --git history [<options>]
    -+git history drop [<options>] <revision>
    +@@ Documentation/git-history.adoc: SYNOPSIS
    + git history abort
    + git history continue
    + git history quit
    ++git history drop <commit>
      
      DESCRIPTION
      -----------
     @@ Documentation/git-history.adoc: COMMANDS
      This command requires a subcommand. Several subcommands are available to
    - rewrite history in different ways.
    + rewrite history in different ways:
      
    -+drop <revision>::
    ++`drop <commit>`::
     +	Drop a commit from the history and reapply all children of that
     +	commit on top of the commit's parent. The commit that is to be
     +	dropped must be reachable from the current `HEAD` commit.
    @@ Documentation/git-history.adoc: COMMANDS
     +root commit. It is invalid to drop a root commit that does not have any
     +child commits, as that would lead to an empty branch.
     +
    + The following commands are used to manage an interrupted history-rewriting
    + operation:
    + 
    +@@ Documentation/git-history.adoc: operation:
    + 	the original branch. The index and working tree are also left unchanged
    + 	as a result.
    + 
     +EXAMPLES
     +--------
     +
    -+* Drop a commit from history.
    -++
    ++Drop a commit from history
    ++~~~~~~~~~~~~~~~~~~~~~~~~~~
    ++
     +----------
     +$ git log --oneline
     +2d4cd6d third
    @@ Documentation/git-history.adoc: COMMANDS
      ## builtin/history.c ##
     @@
      #include "builtin.h"
    + #include "branch.h"
     +#include "commit.h"
     +#include "commit-reach.h"
     +#include "config.h"
    @@ builtin/history.c
     +#include "refs.h"
     +#include "reset.h"
     +#include "revision.h"
    -+#include "sequencer.h"
    -+
    + #include "sequencer.h"
    + 
    + static int cmd_history_abort(int argc,
    +@@ builtin/history.c: static int cmd_history_quit(int argc,
    + 	return ret;
    + }
    + 
     +static int collect_commits(struct repository *repo,
     +			   struct commit *old_commit,
     +			   struct commit *new_commit,
    @@ builtin/history.c
     +	int ret;
     +
     +	/*
    -+	 * Check that the old actually is an ancestor of HEAD. If not
    ++	 * Check that the old commit actually is an ancestor of HEAD. If not
     +	 * the whole request becomes nonsensical.
     +	*/
     +	if (old_commit) {
    @@ builtin/history.c
     +
     +	/*
     +	 * Revisions are in newest-order-first. We have to reverse the
    -+	 * array though so that we pick the oldest commits first. Note
    -+	 * that we keep the first string untouched, as it is the
    -+	 * equivalent of `argv[0]` to `setup_revisions()`.
    ++	 * array though so that we pick the oldest commits first.
     +	 */
     +	for (size_t i = 0, j = out->nr - 1; i < j; i++, j--)
     +		SWAP(out->v[i], out->v[j]);
    @@ builtin/history.c
     +	 * We have performed all safety checks, so we now prepare
     +	 * replaying the commits.
     +	*/
    -+	replay_opts.action = REPLAY_PICK;
    ++	replay_opts.action = REPLAY_HISTORY_EDIT;
     +	sequencer_init_config(&replay_opts);
     +	replay_opts.quiet = 1;
     +	replay_opts.skip_commit_summary = 1;
    @@ builtin/history.c
     +	 * squash that root commit with the first commit we're picking
     +	 * onto it.
     +	 */
    -+	if (!base) {
    ++	if (!base->parents) {
     +		if (commit_tree("", 0, repo->hash_algo->empty_tree, NULL,
     +				&root_commit, NULL, NULL) < 0) {
     +			ret = error(_("Could not create new root commit"));
    @@ builtin/history.c
     +		replay_opts.have_squash_onto = 1;
     +		reset_opts.oid = &root_commit;
     +	} else {
    -+		reset_opts.oid = &base->object.oid;
    ++		reset_opts.oid = &base->parents->item->object.oid;
     +	}
     +
     +	replay_opts.restore_head_target =
    @@ builtin/history.c
     +			    struct repository *repo)
     +{
     +	const char * const usage[] = {
    -+		N_("git history drop [<options>] <revision>"),
    ++		N_("git history drop <commit>"),
     +		NULL,
     +	};
     +	struct option options[] = {
    @@ builtin/history.c
     +		if (ret < 0)
     +			goto out;
     +
    -+		ret = apply_commits(repo, &commits, head, commit_to_drop->parents ?
    -+				    commit_to_drop->parents->item : NULL, "drop");
    ++		ret = apply_commits(repo, &commits, head, commit_to_drop, "drop");
     +		if (ret < 0)
     +			goto out;
     +	}
    @@ builtin/history.c
     +	strbuf_release(&buf);
     +	return ret;
     +}
    - 
    ++
      int cmd_history(int argc,
      		const char **argv,
      		const char *prefix,
    --		struct repository *repo UNUSED)
    -+		struct repository *repo)
    - {
    - 	const char * const usage[] = {
    --		N_("git history [<options>]"),
    -+		N_("git history drop [<options>] <revision>"),
    +@@ builtin/history.c: int cmd_history(int argc,
    + 		N_("git history abort"),
    + 		N_("git history continue"),
    + 		N_("git history quit"),
    ++		N_("git history drop <commit>"),
      		NULL,
      	};
    -+	parse_opt_subcommand_fn *fn = NULL;
    - 	struct option options[] = {
    + 	parse_opt_subcommand_fn *fn = NULL;
    +@@ builtin/history.c: int cmd_history(int argc,
    + 		OPT_SUBCOMMAND("abort", &fn, cmd_history_abort),
    + 		OPT_SUBCOMMAND("continue", &fn, cmd_history_continue),
    + 		OPT_SUBCOMMAND("quit", &fn, cmd_history_quit),
     +		OPT_SUBCOMMAND("drop", &fn, cmd_history_drop),
      		OPT_END(),
      	};
      
    - 	argc = parse_options(argc, argv, prefix, options, usage, 0);
    --	return 0;
    -+	return fn(argc, argv, prefix, repo);
    - }
     
      ## t/meson.build ##
     @@ t/meson.build: integration_tests = [
    -   't3436-rebase-more-options.sh',
        't3437-rebase-fixup-options.sh',
        't3438-rebase-broken-files.sh',
    -+  't3450-history-drop.sh',
    +   't3450-history.sh',
    ++  't3451-history-drop.sh',
        't3500-cherry.sh',
        't3501-revert-cherry-pick.sh',
        't3502-cherry-pick-merge.sh',
    -@@ t/meson.build: if perl.found() and time.found()
    -       timeout: 0,
    -     )
    -   endforeach
    --endif
    - \ No newline at end of file
    -+endif
     
    - ## t/t3450-history-drop.sh (new) ##
    + ## t/t3451-history-drop.sh (new) ##
     @@
     +#!/bin/sh
     +
    @@ t/t3450-history-drop.sh (new)
     +	)
     +'
     +
    ++test_expect_success 'refuses to work with changes in the worktree or index' '
    ++	test_when_finished "rm -rf repo" &&
    ++	git init repo &&
    ++	(
    ++		cd repo &&
    ++		test_commit initial &&
    ++		test_commit file file &&
    ++		echo foo >file &&
    ++		test_must_fail git history drop HEAD 2>err &&
    ++		test_grep "Your local changes to the following files would be overwritten" err &&
    ++		git add file &&
    ++		test_must_fail git history drop HEAD 2>err &&
    ++		test_grep "Your local changes to the following files would be overwritten" err
    ++	)
    ++'
    ++
     +test_expect_success 'can drop tip of a branch' '
     +	test_when_finished "rm -rf repo" &&
     +	git init repo &&
    @@ t/t3450-history-drop.sh (new)
     +	)
     +'
     +
    ++test_expect_success 'conflicts are detected' '
    ++	test_when_finished "rm -rf repo" &&
    ++	git init repo &&
    ++	(
    ++		cd repo &&
    ++		test_commit base &&
    ++		echo original >file &&
    ++		git add . &&
    ++		git commit -m original &&
    ++		echo modified >file &&
    ++		git commit -am modified &&
    ++
    ++		test_must_fail git history drop HEAD~ >err 2>&1 &&
    ++		test_grep CONFLICT err &&
    ++		test_grep "git history continue" err &&
    ++		echo resolved >file &&
    ++		git add file &&
    ++		git history continue &&
    ++
    ++		cat >expect <<-EOF &&
    ++		modified
    ++		base
    ++		EOF
    ++		git log --format=%s >actual &&
    ++		test_cmp expect actual &&
    ++		echo resolved >expect &&
    ++		git cat-file -p HEAD:file >actual &&
    ++		test_cmp expect actual
    ++	)
    ++'
    ++
     +test_done
 6:  5ba28ca5e5 !  9:  95ce67205d builtin/history: implement "reorder" subcommand
    @@ Commit message
         builtin/history: implement "reorder" subcommand
     
         When working in projects where having nice commits matters it's quite
    -    common that developers end up reordering commits a lot. Tihs is
    +    common that developers end up reordering commits a lot. This is
         typically done via interactive rebases, where they can then rearrange
         commits in the instruction sheet.
     
         Still, this operation is a frequent-enough operation to provide a more
    -    direct of doing this imperatively. As such, introduce a new "reorder"
    -    subcommand where users can reorder a commit A to come after or before
    -    another commit B:
    +    direct way of doing this imperatively. As such, introduce a new
    +    "reorder" subcommand where users can reorder a commit A to come after or
    +    before another commit B:
     
             $ git log --oneline
             a978f73 fifth
    @@ Commit message
         Signed-off-by: Patrick Steinhardt <ps@pks.im>
     
      ## Documentation/git-history.adoc ##
    -@@ Documentation/git-history.adoc: SYNOPSIS
    - --------
    - [synopsis]
    - git history drop [<options>] <revision>
    -+git history reorder [<options>] <revision> --(before|after)=<revision>
    +@@ Documentation/git-history.adoc: git history abort
    + git history continue
    + git history quit
    + git history drop <commit>
    ++git history reorder <commit> (--before=<following-commit>|--after=<preceding-commit>)
      
      DESCRIPTION
      -----------
    -@@ Documentation/git-history.adoc: Dropping the root commit converts the child of that commit into the new
    +@@ Documentation/git-history.adoc: rewrite history in different ways:
    + `drop <commit>`::
    + 	Drop a commit from the history and reapply all children of that
    + 	commit on top of the commit's parent. The commit that is to be
    +-	dropped must be reachable from the current `HEAD` commit.
    ++	dropped must be reachable from the currently checked-out commit.
    + +
    + Dropping the root commit converts the child of that commit into the new
      root commit. It is invalid to drop a root commit that does not have any
      child commits, as that would lead to an empty branch.
      
    -+reorder <revision> (--before=<revision>|--after=<revision>)::
    -+	Reorder the commit so that it becomes either the parent
    -+	(`--before=`) or child (`--after=`) of the other specified
    -+	commit. The commits must be related to one another and must be
    -+	reachable from the current `HEAD` commit.
    -+
    - EXAMPLES
    - --------
    ++`reorder <commit> (--before=<following-commit>|--after=<preceding-commit>)`::
    ++	Move the commit so that it becomes either the parent of
    ++	<following-commit> or the child of <preceding-commit>. The commits must
    ++	be related to one another and must be reachable from the current `HEAD`
    ++	commit.
    ++
    + The following commands are used to manage an interrupted history-rewriting
    + operation:
      
     @@ Documentation/git-history.adoc: b1bc1bd third
      e098c27 first
      ----------
      
    -+* Reorder a commit.
    -++
    ++Reorder a commit
    ++~~~~~~~~~~~~~~~~
    ++
     +----------
     +$ git log --oneline
     +a978f73 fifth
    @@ builtin/history.c: static int cmd_history_drop(int argc,
     +			       struct repository *repo)
     +{
     +	const char * const usage[] = {
    -+		N_("git history reorder [<options>] <revision> (--before=<commit>|--after=<commit>)"),
    ++		N_("git history reorder <commit> (--before=<following-commit>|--after=<preceding-commit>)"),
     +		NULL,
     +	};
     +	const char *before = NULL, *after = NULL;
    @@ builtin/history.c: static int cmd_history_drop(int argc,
     +	replace_commits(&commits, &commit_to_reorder->object.oid, NULL, 0);
     +	replace_commits(&commits, &anchor->object.oid, replacement, ARRAY_SIZE(replacement));
     +
    -+	/*
    -+	 * And now we pick commits in the new order on top of either the root
    -+	 * commit or on top the old commit's parent.
    -+	 */
    -+	ret = apply_commits(repo, &commits, head,
    -+			    old->parents ? old->parents->item : NULL, "reorder");
    ++	ret = apply_commits(repo, &commits, head, old, "reorder");
     +	if (ret < 0)
     +		goto out;
     +
    @@ builtin/history.c: static int cmd_history_drop(int argc,
      		const char **argv,
      		const char *prefix,
     @@ builtin/history.c: int cmd_history(int argc,
    - {
    - 	const char * const usage[] = {
    - 		N_("git history drop [<options>] <revision>"),
    -+		N_("git history reorder [<options>] <revision> --(before|after)=<revision>"),
    + 		N_("git history continue"),
    + 		N_("git history quit"),
    + 		N_("git history drop <commit>"),
    ++		N_("git history reorder <commit> (--before=<following-commit>|--after=<preceding-commit>)"),
      		NULL,
      	};
      	parse_opt_subcommand_fn *fn = NULL;
    - 	struct option options[] = {
    +@@ builtin/history.c: int cmd_history(int argc,
    + 		OPT_SUBCOMMAND("continue", &fn, cmd_history_continue),
    + 		OPT_SUBCOMMAND("quit", &fn, cmd_history_quit),
      		OPT_SUBCOMMAND("drop", &fn, cmd_history_drop),
     +		OPT_SUBCOMMAND("reorder", &fn, cmd_history_reorder),
      		OPT_END(),
    @@ builtin/history.c: int cmd_history(int argc,
     
      ## t/meson.build ##
     @@ t/meson.build: integration_tests = [
    -   't3437-rebase-fixup-options.sh',
        't3438-rebase-broken-files.sh',
    -   't3450-history-drop.sh',
    -+  't3451-history-reorder.sh',
    +   't3450-history.sh',
    +   't3451-history-drop.sh',
    ++  't3452-history-reorder.sh',
        't3500-cherry.sh',
        't3501-revert-cherry-pick.sh',
        't3502-cherry-pick-merge.sh',
     
    - ## t/t3451-history-reorder.sh (new) ##
    + ## t/t3452-history-reorder.sh (new) ##
     @@
     +#!/bin/sh
     +
    @@ t/t3451-history-reorder.sh (new)
     +
     +. ./test-lib.sh
     +
    -+test_expect_success 'reorder refuses to work with merge commits' '
    ++test_expect_success 'refuses to work with merge commits' '
     +	test_when_finished "rm -rf repo" &&
     +	git init repo &&
     +	(
    @@ t/t3451-history-reorder.sh (new)
     +	)
     +'
     +
    -+test_expect_success 'reorder requires exactly one of --before or --after' '
    ++test_expect_success 'refuses to work with changes in the worktree or index' '
    ++	test_when_finished "rm -rf repo" &&
    ++	git init repo &&
    ++	(
    ++		cd repo &&
    ++		test_commit initial &&
    ++		test_commit file file &&
    ++		echo foo >file &&
    ++		test_must_fail git history reorder HEAD --before=HEAD~ 2>err &&
    ++		test_grep "Your local changes to the following files would be overwritten" err &&
    ++		git add file &&
    ++		test_must_fail git history reorder HEAD --before=HEAD~ 2>err &&
    ++		test_grep "Your local changes to the following files would be overwritten" err
    ++	)
    ++'
    ++
    ++test_expect_success 'requires exactly one of --before or --after' '
     +	test_when_finished "rm -rf repo" &&
     +	git init repo &&
     +	(
    @@ t/t3451-history-reorder.sh (new)
     +	)
     +'
     +
    -+test_expect_success 'reorder refuses to reorder commit with itself' '
    ++test_expect_success 'refuses to reorder commit with itself' '
     +	test_when_finished "rm -rf repo" &&
     +	git init repo &&
     +	(
    @@ t/t3451-history-reorder.sh (new)
     +		test_must_fail git symbolic-ref HEAD &&
     +		echo "second edit" >file &&
     +		git add file &&
    -+		test_must_fail git cherry-pick --continue &&
    ++		test_must_fail git history continue &&
     +		echo "first edit" >file &&
     +		git add file &&
    -+		git cherry-pick --continue &&
    ++		git history continue &&
     +
     +		cat >expect <<-EOF &&
     +		first edit
 7:  91221a3883 = 10:  1bc1d4f06c add-patch: split out header from "add-interactive.h"
 8:  018d7bd8ea = 11:  fed38713fa add-patch: split out `struct interactive_options`
 9:  915376b78a = 12:  d8ba71c015 add-patch: remove dependency on "add-interactive" subsystem
10:  3fa285e5b8 ! 13:  b56722b519 add-patch: add support for in-memory index patching
    @@ add-patch.c: static int patch_update_file(struct add_p_state *s,
      				error(_("'git apply' failed"));
      		}
     -		if (repo_read_index(s->r) >= 0)
    -+		read_index_from(s->index, s->index_file, s->r->gitdir);
     +		if (read_index_from(s->index, s->index_file, s->r->gitdir) >= 0 &&
     +		    s->index == s->r->index) {
      			repo_refresh_and_write_index(s->r, REFRESH_QUIET, 0,
 -:  ---------- > 14:  5a6b18855e wt-status: provide function to expose status for trees
11:  81e16d3c01 ! 15:  4701b4dff2 builtin/history: implement "split" subcommand
    @@ Commit message
         Signed-off-by: Patrick Steinhardt <ps@pks.im>
     
      ## Documentation/git-history.adoc ##
    -@@ Documentation/git-history.adoc: SYNOPSIS
    - [synopsis]
    - git history drop [<options>] <revision>
    - git history reorder [<options>] <revision> --(before|after)=<revision>
    -+git history split [<options>] <revision> [--] [<pathspec>...]
    +@@ Documentation/git-history.adoc: git history continue
    + git history quit
    + git history drop <commit>
    + git history reorder <commit> (--before=<following-commit>|--after=<preceding-commit>)
    ++git history split [<options>] <commit> [--] [<pathspec>...]
      
      DESCRIPTION
      -----------
    -@@ Documentation/git-history.adoc: reorder <revision> (--before=<revision>|--after=<revision>)::
    - 	commit. The commits must be related to one another and must be
    - 	reachable from the current `HEAD` commit.
    +@@ Documentation/git-history.adoc: child commits, as that would lead to an empty branch.
    + 	be related to one another and must be reachable from the current `HEAD`
    + 	commit.
      
    -+split <revision> [--message=<message>] [--] [<pathspec>...]::
    -+	Interactively split up the commit into two commits by choosing
    ++`split [--message=<message>] <commit> [--] [<pathspec>...]`::
    ++	Interactively split up <commit> into two commits by choosing
     +	hunks introduced by it that will be moved into the new split-out
     +	commit. These hunks will then be written into a new commit that
     +	becomes the parent of the previous commit. The original commit
    @@ Documentation/git-history.adoc: reorder <revision> (--before=<revision>|--after=
     +	commit.
     ++
     +The commit message of the new commit will be asked for by launching the
    -+configured editor. Authorship of the commit will be the same as for the
    -+original commit.
    ++configured editor, unless it has been specified with the `-m` option.
    ++Authorship of the commit will be the same as for the original commit.
     ++
     +If passed, _<pathspec>_ can be used to limit which changes shall be split out
     +of the original commit. Files not matching any of the pathspecs will remain
    -+part of the original commit. For more details about the _<pathspec>_ syntax,
    -+see the 'pathspec' entry.
    ++part of the original commit. For more details, see the 'pathspec' entry in
    ++linkgit:gitglossary[7].
     ++
     +It is invalid to select either all or no hunks, as that would lead to
     +one of the commits becoming empty.
     +
    - EXAMPLES
    - --------
    + The following commands are used to manage an interrupted history-rewriting
    + operation:
      
     @@ Documentation/git-history.adoc: f44a46e third
      bf7438d first
      ----------
      
    -+* Split a commit.
    -++
    ++Split a commit
    ++~~~~~~~~~~~~~~
    ++
     +----------
     +$ git log --stat --oneline
     +3f81232 (HEAD -> main) original
    @@ builtin/history.c
     +#define USE_THE_REPOSITORY_VARIABLE
     +
      #include "builtin.h"
    + #include "branch.h"
     +#include "cache-tree.h"
      #include "commit.h"
      #include "commit-reach.h"
    @@ builtin/history.c
      #include "sequencer.h"
     +#include "sparse-index.h"
      
    - static int collect_commits(struct repository *repo,
    - 			   struct commit *old_commit,
    + static int cmd_history_abort(int argc,
    + 			     const char **argv,
     @@ builtin/history.c: static int cmd_history_reorder(int argc,
      	return ret;
      }
      
    ++static void change_data_free(void *util, const char *str UNUSED)
    ++{
    ++	struct wt_status_change_data *d = util;
    ++	free(d->rename_source);
    ++	free(d);
    ++}
    ++
    ++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 *provided_message,
    ++			       const char *action,
    ++			       struct strbuf *out)
    ++{
    ++	if (!provided_message) {
    ++		struct wt_status s;
    ++		const char *path = git_path_commit_editmsg();
    ++		const char *hint =
    ++			_("Please enter the commit message for the %s changes. Lines starting\n"
    ++			  "with '%s' will be kept; you may remove them yourself if you want to.\n");
    ++
    ++		strbuf_addstr(out, default_message);
    ++		strbuf_addch(out, '\n');
    ++		strbuf_commented_addf(out, comment_line_str, hint, action, comment_line_str);
    ++		write_file_buf(path, out->buf, out->len);
    ++
    ++		wt_status_prepare(repo, &s);
    ++		FREE_AND_NULL(s.branch);
    ++		s.ahead_behind_flags = AHEAD_BEHIND_QUICK;
    ++		s.commit_template = 1;
    ++		s.colopts = 0;
    ++		s.display_comment_prefix = 1;
    ++		s.hints = 0;
    ++		s.use_color = 0;
    ++		s.whence = FROM_COMMIT;
    ++		s.committable = 1;
    ++
    ++		s.fp = fopen(git_path_commit_editmsg(), "a");
    ++		if (!s.fp)
    ++			return error_errno(_("could not open '%s'"), git_path_commit_editmsg());
    ++
    ++		wt_status_collect_changes_trees(&s, old_tree, new_tree);
    ++		wt_status_print(&s);
    ++		wt_status_collect_free_buffers(&s);
    ++		string_list_clear_func(&s.change, change_data_free);
    ++
    ++		strbuf_reset(out);
    ++		if (launch_editor(path, out, NULL)) {
    ++			fprintf(stderr, _("Please supply the message using either -m or -F option.\n"));
    ++			return -1;
    ++		}
    ++		strbuf_stripspace(out, comment_line_str);
    ++
    ++	} else {
    ++		strbuf_addstr(out, provided_message);
    ++	}
    ++
    ++	cleanup_message(out, COMMIT_MSG_CLEANUP_ALL, 0);
    ++
    ++	if (!out->len) {
    ++		fprintf(stderr, _("Aborting commit due to empty commit message.\n"));
    ++		return -1;
    ++	}
    ++
    ++	return 0;
    ++}
    ++
     +static int split_commit(struct repository *repo,
     +			struct commit *original_commit,
     +			struct pathspec *pathspec,
    @@ builtin/history.c: static int cmd_history_reorder(int argc,
     +	struct object_id original_commit_tree_oid, parent_tree_oid;
     +	const char *original_message, *original_body, *ptr;
     +	char original_commit_oid[GIT_MAX_HEXSZ + 1];
    -+	char *split_message_path = NULL, *original_author = NULL;
    ++	char *original_author = NULL;
     +	struct commit_list *parents = NULL;
     +	struct commit *first_commit;
     +	struct tree *split_tree;
    @@ builtin/history.c: static int cmd_history_reorder(int argc,
     +	if (ptr)
     +		original_author = xmemdupz(ptr, len);
     +
    -+	/*
    -+	 * But we do ask the user for a new commit message. This is in contrast
    -+	 * to the second commit, where we'll retain the original commit
    -+	 * message.
    -+	 */
    -+	if (!commit_message) {
    -+		split_message_path = repo_git_path(repo, "SPLIT_MSG");
    -+		strbuf_addch(&split_message, '\n');
    -+		strbuf_commented_addf(&split_message, comment_line_str,
    -+				      _("Please enter a commit message for the split-out changes."));
    -+		write_file_buf(split_message_path, split_message.buf, split_message.len);
    -+
    -+		strbuf_reset(&split_message);
    -+		if (launch_editor(split_message_path, &split_message, NULL)) {
    -+			fprintf(stderr, _("Please supply the message using either -m or -F option.\n"));
    -+			ret = -1;
    -+			goto out;
    -+		}
    -+		strbuf_stripspace(&split_message, comment_line_str);
    -+	} else {
    -+		strbuf_addstr(&split_message, commit_message);
    -+	}
    -+	cleanup_message(&split_message, COMMIT_MSG_CLEANUP_ALL, 0);
    ++	ret = fill_commit_message(repo, &parent_tree_oid, &split_tree->object.oid,
    ++				  "", commit_message, "split-out", &split_message);
    ++	if (ret < 0)
    ++		goto out;
     +
     +	ret = commit_tree(split_message.buf, split_message.len, &split_tree->object.oid,
     +			  original_commit->parents, &out[0], original_author, NULL);
    @@ builtin/history.c: static int cmd_history_reorder(int argc,
     +	strbuf_release(&split_message);
     +	strbuf_release(&index_file);
     +	free_commit_list(parents);
    -+	free(split_message_path);
     +	free(original_author);
     +	release_index(&index);
     +	return ret;
    @@ builtin/history.c: static int cmd_history_reorder(int argc,
     +			     struct repository *repo)
     +{
     +	const char * const usage[] = {
    -+		N_("git history split [<options>] <revision>"),
    ++		N_("git history split [<options>] <commit>"),
     +		NULL,
     +	};
     +	const char *commit_message = NULL;
    @@ builtin/history.c: static int cmd_history_reorder(int argc,
     +	int ret;
     +
     +	argc = parse_options(argc, argv, prefix, options, usage, 0);
    ++	if (argc < 1) {
    ++		ret = error(_("command expects a revision"));
    ++		goto out;
    ++	}
     +	repo_config(repo, git_default_config, NULL);
     +
     +	original_commit = lookup_commit_reference_by_name(argv[0]);
    @@ builtin/history.c: static int cmd_history_reorder(int argc,
     +	replace_commits(&commits, &original_commit->object.oid,
     +			split_commits, ARRAY_SIZE(split_commits));
     +
    -+	/*
    -+	 * And now we pick commits in the new order on top of either the root
    -+	 * commit or on top the old commit's parent.
    -+	 */
    -+	ret = apply_commits(repo, &commits, head,
    -+			    original_commit->parents ? original_commit->parents->item : NULL,
    -+			    "split");
    ++	ret = apply_commits(repo, &commits, head, original_commit, "split");
     +	if (ret < 0)
     +		goto out;
     +
    @@ builtin/history.c: static int cmd_history_reorder(int argc,
      		const char **argv,
      		const char *prefix,
     @@ builtin/history.c: int cmd_history(int argc,
    - 	const char * const usage[] = {
    - 		N_("git history drop [<options>] <revision>"),
    - 		N_("git history reorder [<options>] <revision> --(before|after)=<revision>"),
    -+		N_("git history split [<options>] <revision> [--] [<pathspec>...]"),
    + 		N_("git history quit"),
    + 		N_("git history drop <commit>"),
    + 		N_("git history reorder <commit> (--before=<following-commit>|--after=<preceding-commit>)"),
    ++		N_("git history split [<options>] <commit> [--] [<pathspec>...]"),
      		NULL,
      	};
      	parse_opt_subcommand_fn *fn = NULL;
    - 	struct option options[] = {
    +@@ builtin/history.c: int cmd_history(int argc,
    + 		OPT_SUBCOMMAND("quit", &fn, cmd_history_quit),
      		OPT_SUBCOMMAND("drop", &fn, cmd_history_drop),
      		OPT_SUBCOMMAND("reorder", &fn, cmd_history_reorder),
     +		OPT_SUBCOMMAND("split", &fn, cmd_history_split),
    @@ builtin/history.c: int cmd_history(int argc,
     
      ## t/meson.build ##
     @@ t/meson.build: integration_tests = [
    -   't3438-rebase-broken-files.sh',
    -   't3450-history-drop.sh',
    -   't3451-history-reorder.sh',
    -+  't3452-history-split.sh',
    +   't3450-history.sh',
    +   't3451-history-drop.sh',
    +   't3452-history-reorder.sh',
    ++  't3453-history-split.sh',
        't3500-cherry.sh',
        't3501-revert-cherry-pick.sh',
        't3502-cherry-pick-merge.sh',
     
    - ## t/t3452-history-split.sh (new) ##
    + ## t/t3453-history-split.sh (new) ##
     @@
     +#!/bin/sh
     +
    @@ t/t3452-history-split.sh (new)
     +	)
     +'
     +
    ++test_expect_success 'refuses to work with changes in the worktree or index' '
    ++	test_when_finished "rm -rf repo" &&
    ++	git init repo &&
    ++	(
    ++		cd repo &&
    ++		test_commit initial &&
    ++		touch bar foo &&
    ++		git add . &&
    ++		git commit -m split-me &&
    ++
    ++		echo changed >bar &&
    ++		test_must_fail git history split -m message HEAD 2>err <<-EOF &&
    ++		y
    ++		n
    ++		EOF
    ++		test_grep "Your local changes to the following files would be overwritten" err &&
    ++
    ++		git add bar &&
    ++		test_must_fail git history split -m message HEAD 2>err <<-EOF &&
    ++		y
    ++		n
    ++		EOF
    ++		test_grep "Your local changes to the following files would be overwritten" err
    ++	)
    ++'
    ++
     +test_expect_success 'can split up tip commit' '
     +	test_when_finished "rm -rf repo" &&
     +	git init repo &&
    @@ t/t3452-history-split.sh (new)
     +		git add . &&
     +		git commit -m split-me &&
     +
    ++		git symbolic-ref HEAD >expect &&
     +		set_fake_editor &&
     +		git history split HEAD <<-EOF &&
     +		y
     +		n
     +		EOF
    ++		git symbolic-ref HEAD >actual &&
    ++		test_cmp expect actual &&
     +
     +		expect_log <<-EOF &&
     +		split-me
    @@ t/t3452-history-split.sh (new)
     +	)
     +'
     +
    ++test_expect_success 'aborts with empty commit message' '
    ++	test_when_finished "rm -rf repo" &&
    ++	git init repo &&
    ++	(
    ++		cd repo &&
    ++		touch bar foo &&
    ++		git add . &&
    ++		git commit -m split-me &&
    ++
    ++		test_must_fail git history split HEAD -m "" <<-EOF 2>err &&
    ++		y
    ++		n
    ++		EOF
    ++		test_grep "Aborting commit due to empty commit message." err
    ++	)
    ++'
    ++
     +test_expect_success 'can specify message via option' '
     +	test_when_finished "rm -rf repo" &&
     +	git init repo &&
    @@ t/t3452-history-split.sh (new)
     +	)
     +'
     +
    ++test_expect_success 'commit message editor sees split-out changes' '
    ++	test_when_finished "rm -rf repo" &&
    ++	git init repo &&
    ++	(
    ++		cd repo &&
    ++		touch bar foo &&
    ++		git add . &&
    ++		git commit -m split-me &&
    ++
    ++		write_script fake-editor.sh <<-\EOF &&
    ++		cp "$1" . &&
    ++		echo "some commit message" >>"$1"
    ++		EOF
    ++		test_set_editor "$(pwd)"/fake-editor.sh &&
    ++
    ++		git history split HEAD <<-EOF &&
    ++		y
    ++		n
    ++		EOF
    ++
    ++		cat >expect <<-EOF &&
    ++
    ++		# Please enter the commit message for the split-out changes. Lines starting
    ++		# with ${SQ}#${SQ} will be kept; you may remove them yourself if you want to.
    ++		# Changes to be committed:
    ++		#	new file:   bar
    ++		#
    ++		EOF
    ++		test_cmp expect COMMIT_EDITMSG &&
    ++
    ++		expect_log <<-EOF
    ++		split-me
    ++		some commit message
    ++		EOF
    ++	)
    ++'
    ++
     +test_expect_success 'can use pathspec to limit what gets split' '
     +	test_when_finished "rm -rf repo" &&
     +	git init repo &&
 -:  ---------- > 16:  3e3587d375 builtin/history: implement "reword" subcommand

--- base-commit: c44beea485f0f2feaf460e2ac87fdd5608d63cf0 change-id: 20250819-b4-pks-history-builtin-83398f9a05f0

Previous: Patrick SteinhardtNext: Patrick Steinhardt
Message 62 of 325 in “Introduce git-history(1) command for easy history editing”
  1. 00/11 Introduce git-history(1) command for easy history editingPatrick Steinhardt, Aug 19, 2025
  2. 01/11 sequencer: optionally skip printing commit summaryPatrick Steinhardt, Aug 19, 2025
  3. 02/11 sequencer: add option to rewind HEAD after picking commitsPatrick Steinhardt, Aug 19, 2025
  4. 03/11 cache-tree: allow writing in-memory index as treePatrick Steinhardt, Aug 19, 2025
  5. 04/11 builtin: add new "history" commandPatrick Steinhardt, Aug 19, 2025
  6. 05/11 builtin/history: implement "drop" subcommandPatrick Steinhardt, Aug 19, 2025
  7. Ben KnobleAug 20, 2025
  8. Patrick SteinhardtAug 22, 2025
  9. Jean-Noël AVILAAug 23, 2025
  10. Patrick SteinhardtAug 24, 2025
  11. 06/11 builtin/history: implement "reorder" subcommandPatrick Steinhardt, Aug 19, 2025
  12. Jean-Noël AVILAAug 23, 2025
  13. Kristoffer HaugsbakkAug 24, 2025
  14. Patrick SteinhardtAug 24, 2025
  15. 07/11 add-patch: split out header from "add-interactive.h"Patrick Steinhardt, Aug 19, 2025
  16. 08/11 add-patch: split out `struct interactive_options`Patrick Steinhardt, Aug 19, 2025
  17. 09/11 add-patch: remove dependency on "add-interactive" subsystemPatrick Steinhardt, Aug 19, 2025
  18. 10/11 add-patch: add support for in-memory index patchingPatrick Steinhardt, Aug 19, 2025
  19. D. Ben KnobleAug 20, 2025
  20. Patrick SteinhardtAug 22, 2025
  21. 11/11 builtin/history: implement "split" subcommandPatrick Steinhardt, Aug 19, 2025
  22. D. Ben KnobleAug 20, 2025
  23. Patrick SteinhardtAug 22, 2025
  24. Junio C HamanoAug 22, 2025
  25. Patrick SteinhardtAug 24, 2025
  26. Jean-Noël AVILAAug 23, 2025
  27. Patrick SteinhardtAug 24, 2025
  28. D. Ben KnobleAug 19, 2025
  29. Patrick SteinhardtAug 20, 2025
  30. Ben KnobleAug 20, 2025
  31. Junio C HamanoAug 20, 2025
  32. Ben KnobleAug 20, 2025
  33. Patrick SteinhardtAug 22, 2025
  34. Junio C HamanoAug 22, 2025
  35. Sergey OrganovAug 21, 2025
  36. Ben KnobleAug 21, 2025
  37. Sergey OrganovAug 21, 2025
  38. Martin von ZweigbergkAug 24, 2025
  39. Patrick SteinhardtAug 24, 2025
  40. SZEDER GáborSep 17, 2025
  41. Matthias BeyerDec 3, 2025
  42. Phillip WoodDec 10, 2025
  43. Matthias BeyerDec 10, 2025
  44. Phillip WoodDec 10, 2025
  45. Junio C HamanoDec 10, 2025
  46. Patrick SteinhardtDec 19, 2025
  47. SZEDER GáborDec 19, 2025
  48. Patrick SteinhardtDec 19, 2025
  49. Elijah NewrenDec 19, 2025
  50. Elijah NewrenDec 20, 2025
  51. Patrick SteinhardtJan 6, 2026
  52. Phillip WoodDec 22, 2025
  53. Patrick SteinhardtJan 6, 2026
  54. D. Ben KnobleDec 22, 2025
  55. Martin von ZweigbergkDec 10, 2025
  56. Elijah NewrenDec 10, 2025
  57. Martin von ZweigbergkDec 10, 2025
  58. Elijah NewrenDec 10, 2025
  59. Kristoffer HaugsbakkDec 15, 2025
  60. Kristoffer HaugsbakkAug 24, 2025
  61. Patrick SteinhardtAug 24, 2025
  62. 00/16 Introduce git-history(1) command for easy history editingPatrick Steinhardt, Aug 24, 2025
  63. 01/16 sequencer: optionally skip printing commit summaryPatrick Steinhardt, Aug 24, 2025
  64. 02/16 sequencer: add option to rewind HEAD after picking commitsPatrick Steinhardt, Aug 24, 2025
  65. 03/16 sequencer: introduce new history editing modePatrick Steinhardt, Aug 24, 2025
  66. D. Ben KnobleAug 26, 2025
  67. Patrick SteinhardtSep 3, 2025
  68. 04/16 sequencer: stop using `the_repository` in `sequencer_remove_state()`Patrick Steinhardt, Aug 24, 2025
  69. 05/16 cache-tree: allow writing in-memory index as treePatrick Steinhardt, Aug 24, 2025
  70. Junio C HamanoAug 25, 2025
  71. Patrick SteinhardtSep 3, 2025
  72. 06/16 builtin: add new "history" commandPatrick Steinhardt, Aug 24, 2025
  73. 07/16 builtin/history: introduce subcommands to manage interrupted rewritesPatrick Steinhardt, Aug 24, 2025
  74. 08/16 builtin/history: implement "drop" subcommandPatrick Steinhardt, Aug 24, 2025
  75. 09/16 builtin/history: implement "reorder" subcommandPatrick Steinhardt, Aug 24, 2025
  76. D. Ben KnobleAug 26, 2025
  77. Patrick SteinhardtSep 3, 2025
  78. 10/16 add-patch: split out header from "add-interactive.h"Patrick Steinhardt, Aug 24, 2025
  79. Junio C HamanoAug 25, 2025
  80. 11/16 add-patch: split out `struct interactive_options`Patrick Steinhardt, Aug 24, 2025
  81. 12/16 add-patch: remove dependency on "add-interactive" subsystemPatrick Steinhardt, Aug 24, 2025
  82. Junio C HamanoAug 25, 2025
  83. 13/16 add-patch: add support for in-memory index patchingPatrick Steinhardt, Aug 24, 2025
  84. 14/16 wt-status: provide function to expose status for treesPatrick Steinhardt, Aug 24, 2025
  85. 15/16 builtin/history: implement "split" subcommandPatrick Steinhardt, Aug 24, 2025
  86. Kristoffer HaugsbakkAug 24, 2025
  87. Patrick SteinhardtSep 3, 2025
  88. D. Ben KnobleAug 26, 2025
  89. Patrick SteinhardtSep 3, 2025
  90. D. Ben KnobleSep 3, 2025
  91. Patrick SteinhardtSep 4, 2025
  92. D. Ben KnobleSep 12, 2025
  93. Patrick SteinhardtSep 15, 2025
  94. Ben KnobleSep 15, 2025
  95. 16/16 builtin/history: implement "reword" subcommandPatrick Steinhardt, Aug 24, 2025
  96. Kristoffer HaugsbakkAug 24, 2025
  97. Patrick SteinhardtSep 3, 2025
  98. D. Ben KnobleSep 3, 2025
  99. Patrick SteinhardtSep 4, 2025
  100. 00/18 Introduce git-history(1) command for easy history editingPatrick Steinhardt, Sep 4, 2025
  101. 01/18 sequencer: optionally skip printing commit summaryPatrick Steinhardt, Sep 4, 2025
  102. Phillip WoodSep 10, 2025
  103. Patrick SteinhardtSep 15, 2025
  104. 02/18 sequencer: add option to rewind HEAD after picking commitsPatrick Steinhardt, Sep 4, 2025
  105. Phillip WoodSep 10, 2025
  106. Patrick SteinhardtSep 15, 2025
  107. Phillip WoodSep 15, 2025
  108. 03/18 sequencer: introduce new history editing modePatrick Steinhardt, Sep 4, 2025
  109. 04/18 sequencer: stop using `the_repository` in `sequencer_remove_state()`Patrick Steinhardt, Sep 4, 2025
  110. 05/18 sequencer: wire up "rewritten-hook" for REPLAY_HISTORY_EDITPatrick Steinhardt, Sep 4, 2025
  111. 06/18 cache-tree: allow writing in-memory index as treePatrick Steinhardt, Sep 4, 2025
  112. 07/18 builtin: add new "history" commandPatrick Steinhardt, Sep 4, 2025
  113. 08/18 builtin/history: introduce subcommands to manage interrupted rewritesPatrick Steinhardt, Sep 4, 2025
  114. 09/18 builtin/history: implement "drop" subcommandPatrick Steinhardt, Sep 4, 2025
  115. 10/18 builtin/history: implement "reorder" subcommandPatrick Steinhardt, Sep 4, 2025
  116. 11/18 add-patch: split out header from "add-interactive.h"Patrick Steinhardt, Sep 4, 2025
  117. 12/18 add-patch: split out `struct interactive_options`Patrick Steinhardt, Sep 4, 2025
  118. 13/18 add-patch: remove dependency on "add-interactive" subsystemPatrick Steinhardt, Sep 4, 2025
  119. 14/18 add-patch: add support for in-memory index patchingPatrick Steinhardt, Sep 4, 2025
  120. 15/18 wt-status: provide function to expose status for treesPatrick Steinhardt, Sep 4, 2025
  121. 16/18 sequencer: allow callers to provide mappings for the old commitPatrick Steinhardt, Sep 4, 2025
  122. 17/18 builtin/history: implement "split" subcommandPatrick Steinhardt, Sep 4, 2025
  123. Phillip WoodSep 10, 2025
  124. Patrick SteinhardtSep 15, 2025
  125. 18/18 builtin/history: implement "reword" subcommandPatrick Steinhardt, Sep 4, 2025
  126. Phillip WoodSep 10, 2025
  127. Patrick SteinhardtSep 15, 2025
  128. Phillip WoodSep 15, 2025
  129. Patrick SteinhardtSep 16, 2025
  130. Phillip WoodSep 16, 2025
  131. Kristoffer HaugsbakkSep 5, 2025
  132. Patrick SteinhardtSep 5, 2025
  133. Elijah NewrenSep 7, 2025
  134. Phillip WoodSep 10, 2025
  135. Phillip WoodSep 10, 2025
  136. Patrick SteinhardtSep 15, 2025
  137. Oswald BuddenhagenSep 16, 2025
  138. Junio C HamanoSep 10, 2025
  139. Patrick SteinhardtSep 15, 2025
  140. 00/12 Introduce git-history(1) command for easy history editingPatrick Steinhardt, Oct 1, 2025
  141. 01/12 wt-status: provide function to expose status for treesPatrick Steinhardt, Oct 1, 2025
  142. Karthik NayakOct 14, 2025
  143. Patrick SteinhardtOct 21, 2025
  144. 02/12 replay: extract logic to pick commitsPatrick Steinhardt, Oct 1, 2025
  145. 03/12 replay: stop using `the_repository`Patrick Steinhardt, Oct 1, 2025
  146. Karthik NayakOct 14, 2025
  147. 04/12 replay: parse commits before dereferencing themPatrick Steinhardt, Oct 1, 2025
  148. Karthik NayakOct 14, 2025
  149. 05/12 builtin: add new "history" commandPatrick Steinhardt, Oct 1, 2025
  150. Kristoffer HaugsbakkOct 2, 2025
  151. Karthik NayakOct 14, 2025
  152. Patrick SteinhardtOct 21, 2025
  153. Junio C HamanoOct 22, 2025
  154. Karthik NayakOct 22, 2025
  155. 06/12 builtin/history: implement "reword" subcommandPatrick Steinhardt, Oct 1, 2025
  156. Karthik NayakOct 14, 2025
  157. Patrick SteinhardtOct 21, 2025
  158. 07/12 add-patch: split out header from "add-interactive.h"Patrick Steinhardt, Oct 1, 2025
  159. 08/12 add-patch: split out `struct interactive_options`Patrick Steinhardt, Oct 1, 2025
  160. Kristoffer HaugsbakkOct 2, 2025
  161. Karthik NayakOct 14, 2025
  162. Patrick SteinhardtOct 21, 2025
  163. 09/12 add-patch: remove dependency on "add-interactive" subsystemPatrick Steinhardt, Oct 1, 2025
  164. 10/12 add-patch: add support for in-memory index patchingPatrick Steinhardt, Oct 1, 2025
  165. Kristoffer HaugsbakkOct 2, 2025
  166. Patrick SteinhardtOct 2, 2025
  167. Karthik NayakOct 14, 2025
  168. 11/12 cache-tree: allow writing in-memory index as treePatrick Steinhardt, Oct 1, 2025
  169. 12/12 builtin/history: implement "split" subcommandPatrick Steinhardt, Oct 1, 2025
  170. Karthik NayakOct 14, 2025
  171. Patrick SteinhardtOct 21, 2025
  172. D. Ben KnobleOct 21, 2025
  173. Patrick SteinhardtOct 27, 2025
  174. Karthik NayakOct 14, 2025
  175. Junio C HamanoOct 14, 2025
  176. 00/12 Introduce git-history(1) command for easy history editingPatrick Steinhardt, Oct 21, 2025
  177. 01/12 wt-status: provide function to expose status for treesPatrick Steinhardt, Oct 21, 2025
  178. Junio C HamanoOct 21, 2025
  179. 02/12 replay: extract logic to pick commitsPatrick Steinhardt, Oct 21, 2025
  180. Junio C HamanoOct 21, 2025
  181. 03/12 replay: stop using `the_repository`Patrick Steinhardt, Oct 21, 2025
  182. Junio C HamanoOct 21, 2025
  183. Junio C HamanoOct 21, 2025
  184. 04/12 replay: parse commits before dereferencing themPatrick Steinhardt, Oct 21, 2025
  185. Junio C HamanoOct 21, 2025
  186. Patrick SteinhardtOct 27, 2025
  187. 05/12 builtin: add new "history" commandPatrick Steinhardt, Oct 21, 2025
  188. Junio C HamanoOct 21, 2025
  189. Patrick SteinhardtOct 27, 2025
  190. 06/12 builtin/history: implement "reword" subcommandPatrick Steinhardt, Oct 21, 2025
  191. Junio C HamanoOct 21, 2025
  192. D. Ben KnobleOct 21, 2025
  193. Patrick SteinhardtOct 27, 2025
  194. Patrick SteinhardtOct 27, 2025
  195. 07/12 add-patch: split out header from "add-interactive.h"Patrick Steinhardt, Oct 21, 2025
  196. 08/12 add-patch: split out `struct interactive_options`Patrick Steinhardt, Oct 21, 2025
  197. 09/12 add-patch: remove dependency on "add-interactive" subsystemPatrick Steinhardt, Oct 21, 2025
  198. 10/12 add-patch: add support for in-memory index patchingPatrick Steinhardt, Oct 21, 2025
  199. 11/12 cache-tree: allow writing in-memory index as treePatrick Steinhardt, Oct 21, 2025
  200. 12/12 builtin/history: implement "split" subcommandPatrick Steinhardt, Oct 21, 2025
  201. Junio C HamanoOct 21, 2025
  202. 00/11 Introduce git-history(1) command for easy history editingPatrick Steinhardt, Oct 27, 2025
  203. 01/11 wt-status: provide function to expose status for treesPatrick Steinhardt, Oct 27, 2025
  204. 02/11 replay: extract logic to pick commitsPatrick Steinhardt, Oct 27, 2025
  205. Phillip WoodNov 17, 2025
  206. Elijah NewrenNov 20, 2025
  207. 03/11 replay: stop using `the_repository`Patrick Steinhardt, Oct 27, 2025
  208. Elijah NewrenNov 20, 2025
  209. Patrick SteinhardtDec 2, 2025
  210. 04/11 builtin: add new "history" commandPatrick Steinhardt, Oct 27, 2025
  211. Phillip WoodNov 17, 2025
  212. Patrick SteinhardtDec 2, 2025
  213. Elijah NewrenNov 20, 2025
  214. Patrick SteinhardtDec 2, 2025
  215. D. Ben KnobleDec 2, 2025
  216. Patrick SteinhardtDec 3, 2025
  217. 05/11 builtin/history: implement "reword" subcommandPatrick Steinhardt, Oct 27, 2025
  218. Phillip WoodNov 17, 2025
  219. Patrick SteinhardtDec 2, 2025
  220. Phillip WoodDec 10, 2025
  221. Elijah NewrenNov 20, 2025
  222. Patrick SteinhardtDec 2, 2025
  223. SZEDER GáborNov 25, 2025
  224. Patrick SteinhardtDec 2, 2025
  225. 06/11 add-patch: split out header from "add-interactive.h"Patrick Steinhardt, Oct 27, 2025
  226. Elijah NewrenNov 20, 2025
  227. 07/11 add-patch: split out `struct interactive_options`Patrick Steinhardt, Oct 27, 2025
  228. Elijah NewrenNov 20, 2025
  229. Phillip WoodNov 20, 2025
  230. Patrick SteinhardtDec 2, 2025
  231. 08/11 add-patch: remove dependency on "add-interactive" subsystemPatrick Steinhardt, Oct 27, 2025
  232. Elijah NewrenNov 20, 2025
  233. Phillip WoodNov 20, 2025
  234. 09/11 add-patch: add support for in-memory index patchingPatrick Steinhardt, Oct 27, 2025
  235. Elijah NewrenNov 20, 2025
  236. Phillip WoodNov 20, 2025
  237. Patrick SteinhardtDec 2, 2025
  238. 10/11 cache-tree: allow writing in-memory index as treePatrick Steinhardt, Oct 27, 2025
  239. Elijah NewrenNov 20, 2025
  240. 11/11 builtin/history: implement "split" subcommandPatrick Steinhardt, Oct 27, 2025
  241. Elijah NewrenNov 20, 2025
  242. Patrick SteinhardtDec 2, 2025
  243. Phillip WoodNov 21, 2025
  244. Patrick SteinhardtDec 2, 2025
  245. Phillip WoodDec 10, 2025
  246. Patrick SteinhardtDec 19, 2025
  247. Sergey OrganovNov 12, 2025
  248. Elijah NewrenNov 20, 2025
  249. Junio C HamanoNov 20, 2025
  250. Elijah NewrenNov 20, 2025
  251. Junio C HamanoNov 20, 2025
  252. Elijah NewrenNov 20, 2025
  253. Phillip WoodNov 21, 2025
  254. Junio C HamanoNov 21, 2025
  255. Elijah NewrenNov 23, 2025
  256. Patrick SteinhardtDec 2, 2025
  257. Elijah NewrenDec 5, 2025
  258. Patrick SteinhardtDec 9, 2025
  259. Martin von ZweigbergkDec 9, 2025
  260. Phillip WoodDec 10, 2025
  261. Elijah NewrenDec 10, 2025
  262. Kristoffer HaugsbakkDec 9, 2025
  263. Working on top of mega mergesD. Ben Knoble, Dec 12, 2025
  264. Elijah NewrenNov 23, 2025
  265. Phillip WoodNov 24, 2025
  266. Elijah NewrenNov 25, 2025
  267. 00/12 Introduce git-history(1) command for easy history editingPatrick Steinhardt, Dec 3, 2025
  268. 01/12 wt-status: provide function to expose status for treesPatrick Steinhardt, Dec 3, 2025
  269. 02/12 replay: extract logic to pick commitsPatrick Steinhardt, Dec 3, 2025
  270. 03/12 replay: stop using `the_repository`Patrick Steinhardt, Dec 3, 2025
  271. 04/12 builtin: add new "history" commandPatrick Steinhardt, Dec 3, 2025
  272. Kristoffer HaugsbakkDec 22, 2025
  273. Patrick SteinhardtJan 6, 2026
  274. 05/12 builtin/history: implement "reword" subcommandPatrick Steinhardt, Dec 3, 2025
  275. 06/12 add-patch: split out header from "add-interactive.h"Patrick Steinhardt, Dec 3, 2025
  276. 07/12 add-patch: split out `struct interactive_options`Patrick Steinhardt, Dec 3, 2025
  277. 08/12 add-patch: remove dependency on "add-interactive" subsystemPatrick Steinhardt, Dec 3, 2025
  278. 09/12 add-patch: add support for in-memory index patchingPatrick Steinhardt, Dec 3, 2025
  279. 10/12 add-patch: allow disabling editing of hunksPatrick Steinhardt, Dec 3, 2025
  280. 11/12 cache-tree: allow writing in-memory index as treePatrick Steinhardt, Dec 3, 2025
  281. 12/12 builtin/history: implement "split" subcommandPatrick Steinhardt, Dec 3, 2025
  282. 0/7 Introduce git-history(1) command for easy history editingPatrick Steinhardt, Jan 9, 2026
  283. 1/7 builtin/replay: extract core logic to replay revisionsPatrick Steinhardt, Jan 9, 2026
  284. Elijah NewrenJan 10, 2026
  285. Patrick SteinhardtJan 12, 2026
  286. 2/7 builtin/replay: move core logic into "libgit.a"Patrick Steinhardt, Jan 9, 2026
  287. Elijah NewrenJan 10, 2026
  288. Patrick SteinhardtJan 12, 2026
  289. Elijah NewrenJan 13, 2026
  290. Patrick SteinhardtJan 13, 2026
  291. 3/7 replay: small set of cleanupsPatrick Steinhardt, Jan 9, 2026
  292. 4/7 replay: yield the object ID of the final rewritten commitPatrick Steinhardt, Jan 9, 2026
  293. Elijah NewrenJan 10, 2026
  294. Patrick SteinhardtJan 12, 2026
  295. 5/7 wt-status: provide function to expose status for treesPatrick Steinhardt, Jan 9, 2026
  296. 6/7 builtin: add new "history" commandPatrick Steinhardt, Jan 9, 2026
  297. Elijah NewrenJan 10, 2026
  298. Patrick SteinhardtJan 12, 2026
  299. 7/7 builtin/history: implement "reword" subcommandPatrick Steinhardt, Jan 9, 2026
  300. Elijah NewrenJan 10, 2026
  301. SZEDER GáborJan 10, 2026
  302. Patrick SteinhardtJan 12, 2026
  303. 0/2 SomeElijah Newren, Jan 11, 2026
  304. 8/7 SQUASH ME: FixupsElijah Newren, Jan 11, 2026
  305. 9/7 history: fix detached HEAD handlingElijah Newren, Jan 11, 2026
  306. Elijah NewrenJan 11, 2026
  307. Patrick SteinhardtJan 12, 2026
  308. 0/8 Introduce git-history(1) command for easy history editingPatrick Steinhardt, Jan 13, 2026
  309. 1/8 builtin/replay: extract core logic to replay revisionsPatrick Steinhardt, Jan 13, 2026
  310. 2/8 builtin/replay: move core logic into "libgit.a"Patrick Steinhardt, Jan 13, 2026
  311. 3/8 replay: small set of cleanupsPatrick Steinhardt, Jan 13, 2026
  312. 4/8 replay: support empty commit rangesPatrick Steinhardt, Jan 13, 2026
  313. 5/8 replay: support updating detached HEADPatrick Steinhardt, Jan 13, 2026
  314. 6/8 wt-status: provide function to expose status for treesPatrick Steinhardt, Jan 13, 2026
  315. 7/8 builtin: add new "history" commandPatrick Steinhardt, Jan 13, 2026
  316. 8/8 builtin/history: implement "reword" subcommandPatrick Steinhardt, Jan 13, 2026
  317. SZEDER GáborJan 16, 2026
  318. Elijah NewrenJan 17, 2026
  319. Junio C HamanoJan 18, 2026
  320. Junio C HamanoFeb 3, 2026
  321. Patrick SteinhardtFeb 5, 2026
  322. Elijah NewrenJan 16, 2026
  323. Junio C HamanoJan 16, 2026
  324. SZEDER GáborJan 16, 2026
  325. Junio C HamanoJan 21, 2026

Read the whole thread, see it on lore, or plain text.

$ cat FOOTERMessages come from the public archive at lore.kernel.org/git, fetched every hour. The front page is chosen and written each morning by an AI editor and can be wrong; the threads themselves are the record. About and API. For agents: an MCP server at https://gitlist.dev/mcp, and any thread, story or person page as Markdown by adding .md to its URL (or sending Accept: text/markdown). Details in /llms.txt.