]> Kevux Git Server - rit/commit
builtin: add new "history" command
authorPatrick Steinhardt <ps@pks.im>
Tue, 13 Jan 2026 09:54:38 +0000 (10:54 +0100)
committerJunio C Hamano <gitster@pobox.com>
Tue, 13 Jan 2026 13:41:17 +0000 (05:41 -0800)
commita675183d483cb106c076395936cd9e602ae94404
tree0948d0dc9ed506dfa941e08948de36457ed925db
parent475ade1cd6e8ff07495b4b5871a69f7b385259f7
builtin: add new "history" command

When rewriting history via git-rebase(1) there are a few very common use
cases:

  - The ordering of two commits should be reversed.

  - A commit should be split up into two commits.

  - A commit should be dropped from the history completely.

  - Multiple commits should be squashed into one.

  - Editing an existing commit that is not the tip of the current
    branch.

While these operations are all doable, it often feels needlessly kludgey
to do so by doing an interactive rebase, using the editor to say what
one wants, and then perform the actions. Also, some operations like
splitting up a commit into two are way more involved than that and
require a whole series of commands.

Rebases also do not update dependent branches. The use of stacked
branches has grown quite common with competing version control systems
like Jujutsu though, so it clearly is a need that users have. While
rebases _can_ serve this use case if one always works on the latest
stacked branch, it is somewhat awkward and very easy to get wrong.

Add a new "history" command to plug these gaps. This command will have
several different subcommands to imperatively rewrite history for common
use cases like the above.

Signed-off-by: Patrick Steinhardt <ps@pks.im>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
.gitignore
Documentation/git-history.adoc [new file with mode: 0644]
Documentation/meson.build
Makefile
builtin.h
builtin/history.c [new file with mode: 0644]
command-list.txt
git.c
meson.build
t/meson.build
t/t3450-history.sh [new file with mode: 0755]