aboutsummaryrefslogtreecommitdiff
path: root/Documentation
diff options
context:
space:
mode:
authorJunio C Hamano <gitster@pobox.com>2026-02-09 12:09:09 -0800
committerJunio C Hamano <gitster@pobox.com>2026-02-09 12:09:09 -0800
commit7bf3785d0973d229fa21a76122c7e4735a2b1ffb (patch)
tree9ee2a41b83f2f18bf0cb63feec23320eda20cc5e /Documentation
parent3e0db84c88c57e70ac8be8c196dfa92c5d656fbc (diff)
parentd205234cb05a5e330c0f7f5b3ea764533a74d69e (diff)
downloadgit-7bf3785d0973d229fa21a76122c7e4735a2b1ffb.tar.xz
Merge branch 'ps/history'
"git history" history rewriting UI. * ps/history: builtin/history: implement "reword" subcommand builtin: add new "history" command wt-status: provide function to expose status for trees replay: support updating detached HEAD replay: support empty commit ranges replay: small set of cleanups builtin/replay: move core logic into "libgit.a" builtin/replay: extract core logic to replay revisions
Diffstat (limited to 'Documentation')
-rw-r--r--Documentation/git-history.adoc73
-rw-r--r--Documentation/meson.build1
2 files changed, 74 insertions, 0 deletions
diff --git a/Documentation/git-history.adoc b/Documentation/git-history.adoc
new file mode 100644
index 0000000000..154e262b76
--- /dev/null
+++ b/Documentation/git-history.adoc
@@ -0,0 +1,73 @@
+git-history(1)
+==============
+
+NAME
+----
+git-history - EXPERIMENTAL: Rewrite history
+
+SYNOPSIS
+--------
+[synopsis]
+git history reword <commit> [--ref-action=(branches|head|print)]
+
+DESCRIPTION
+-----------
+
+Rewrite history by rearranging or modifying specific commits in the
+history.
+
+THIS COMMAND IS EXPERIMENTAL. THE BEHAVIOR MAY CHANGE.
+
+This command is related to linkgit:git-rebase[1] in that both commands can be
+used to rewrite history. There are a couple of major differences though:
+
+* linkgit:git-history[1] can work in a bare repository as it does not need to
+ touch either the index or the worktree.
+* linkgit:git-history[1] does not execute any linkgit:githooks[5] at the
+ current point in time. This may change in the future.
+* linkgit:git-history[1] by default updates all branches that are descendants
+ of the original commit to point to the rewritten commit.
+
+Overall, linkgit:git-history[1] aims to provide a more opinionated way to modify
+your commit history that is simpler to use compared to linkgit:git-rebase[1] in
+general.
+
+Use linkgit:git-rebase[1] if you want to reapply a range of commits onto a
+different base, or interactive rebases if you want to edit a range of commits
+at once.
+
+LIMITATIONS
+-----------
+
+This command does not (yet) work with histories that contain merges. You
+should use linkgit:git-rebase[1] with the `--rebase-merges` flag instead.
+
+Furthermore, the command does not support operations that can result in merge
+conflicts. This limitation is by design as history rewrites are not intended to
+be stateful operations. The limitation can be lifted once (if) Git learns about
+first-class conflicts.
+
+COMMANDS
+--------
+
+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
+---
+Part of the linkgit:git[1] suite
diff --git a/Documentation/meson.build b/Documentation/meson.build
index f02dbc20cb..fd2e8cc02d 100644
--- a/Documentation/meson.build
+++ b/Documentation/meson.build
@@ -64,6 +64,7 @@ manpages = {
'git-gui.adoc' : 1,
'git-hash-object.adoc' : 1,
'git-help.adoc' : 1,
+ 'git-history.adoc' : 1,
'git-hook.adoc' : 1,
'git-http-backend.adoc' : 1,
'git-http-fetch.adoc' : 1,