diff options
| author | Patrick Steinhardt <ps@pks.im> | 2026-01-13 10:54:39 +0100 |
|---|---|---|
| committer | Junio C Hamano <gitster@pobox.com> | 2026-01-13 05:41:17 -0800 |
| commit | d205234cb05a5e330c0f7f5b3ea764533a74d69e (patch) | |
| tree | 8977722181bf9b8eb485d94ff7257a8e03f866fa /Documentation | |
| parent | a675183d483cb106c076395936cd9e602ae94404 (diff) | |
| download | git-d205234cb05a5e330c0f7f5b3ea764533a74d69e.tar.xz | |
builtin/history: implement "reword" subcommand
Implement a new "reword" subcommand for git-history(1). This subcommand
is similar to the user performing an interactive rebase with a single
commit changed to use the "reword" instruction.
The "reword" subcommand is built on top of the replay subsystem
instead of the sequencer. This leads to some major differences compared
to git-rebase(1):
- We do not check out the commit that is to be reworded and instead
perform the operation in-memory. This has the obvious benefit of
being significantly faster compared to git-rebase(1), but even more
importantly it allows the user to rewrite history even if there are
local changes in the working tree or in the index.
- We do not execute any hooks, even though we leave some room for
changing this in the future.
- By default, all local branches that contain the commit will be
rewritten. This especially helps with workflows that use stacked
branches.
Helped-by: Elijah Newren <newren@gmail.com>
Signed-off-by: Patrick Steinhardt <ps@pks.im>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
Diffstat (limited to 'Documentation')
| -rw-r--r-- | Documentation/git-history.adoc | 20 |
1 files changed, 18 insertions, 2 deletions
diff --git a/Documentation/git-history.adoc b/Documentation/git-history.adoc index 68c35f36b9..154e262b76 100644 --- a/Documentation/git-history.adoc +++ b/Documentation/git-history.adoc @@ -8,7 +8,7 @@ git-history - EXPERIMENTAL: Rewrite history SYNOPSIS -------- [synopsis] -git history [<options>] +git history reword <commit> [--ref-action=(branches|head|print)] DESCRIPTION ----------- @@ -50,7 +50,23 @@ first-class conflicts. COMMANDS -------- -No commands are supported yet. +The following commands are available to rewrite history in different ways: + +`reword <commit>`:: + Rewrite the commit message of the specified commit. All the other + details of this commit remain unchanged. This command will spawn an + editor with the current message of that commit. + +OPTIONS +------- + +`--ref-action=(branches|head|print)`:: + Control which references will be updated by the command, if any. With + `branches`, all local branches that point to commits which are + descendants of the original commit will be rewritten. With `head`, only + the current `HEAD` reference will be rewritten. With `print`, all + updates as they would be performed with `branches` are printed in a + format that can be consumed by linkgit:git-update-ref[1]. GIT --- |
