]> git.ipfire.org Git - thirdparty/git.git/commit
builtin/history: introduce "fixup" subcommand
authorPatrick Steinhardt <ps@pks.im>
Mon, 27 Apr 2026 05:53:53 +0000 (07:53 +0200)
committerJunio C Hamano <gitster@pobox.com>
Mon, 27 Apr 2026 13:20:57 +0000 (22:20 +0900)
commitc6c225793003ffb8b376c8994d44ca63bc04ac40
tree32172d8b67e4ad7b407fe1daac09a97b88c19c5d
parent88191ea02330627a85664909026fb6953e0d8af8
builtin/history: introduce "fixup" subcommand

The newly introduced git-history(1) command provides functionality to
easily edit commit history while also rebasing dependent branches. The
functionality exposed by this command is still somewhat limited though.

One common use case when editing commit history that is not yet covered
is fixing up a specific commit. Introduce a new subcommand that allows
the user to do exactly that by performing a three-way merge into the
target's commit tree, using HEAD's tree as the merge base. The flow is
thus essentially:

    $ echo changes >file
    $ git add file
    $ git history fixup HEAD~

Like with the other commands, this will automatically rebase dependent
branches, as well. Unlike the other commands though:

  - The command does not work in a bare repository as it interacts with
    the index.

  - The command may run into merge conflicts. If so, the command will
    simply abort.

Especially the second item limits the usefulness of this command a bit.
But there are plans to introduce first-class conflicts into Git, which
will help use cases like this one.

Signed-off-by: Patrick Steinhardt <ps@pks.im>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
Documentation/git-history.adoc
builtin/history.c
t/meson.build
t/t3453-history-fixup.sh [new file with mode: 0755]