Skip to content

Commit 5312f19

Browse files
pks-tgitster
authored andcommitted
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 <[email protected]> Signed-off-by: Patrick Steinhardt <[email protected]> Signed-off-by: Junio C Hamano <[email protected]>
1 parent 2f83288 commit 5312f19

File tree

5 files changed

+823
-10
lines changed

5 files changed

+823
-10
lines changed

Documentation/git-history.adoc

Lines changed: 18 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ git-history - EXPERIMENTAL: Rewrite history
88
SYNOPSIS
99
--------
1010
[synopsis]
11-
git history [<options>]
11+
git history reword <commit> [--ref-action=(branches|head|print)]
1212

1313
DESCRIPTION
1414
-----------
@@ -50,7 +50,23 @@ first-class conflicts.
5050
COMMANDS
5151
--------
5252

53-
No commands are supported yet.
53+
The following commands are available to rewrite history in different ways:
54+
55+
`reword <commit>`::
56+
Rewrite the commit message of the specified commit. All the other
57+
details of this commit remain unchanged. This command will spawn an
58+
editor with the current message of that commit.
59+
60+
OPTIONS
61+
-------
62+
63+
`--ref-action=(branches|head|print)`::
64+
Control which references will be updated by the command, if any. With
65+
`branches`, all local branches that point to commits which are
66+
descendants of the original commit will be rewritten. With `head`, only
67+
the current `HEAD` reference will be rewritten. With `print`, all
68+
updates as they would be performed with `branches` are printed in a
69+
format that can be consumed by linkgit:git-update-ref[1].
5470

5571
GIT
5672
---

0 commit comments

Comments
 (0)