Re: [PATCH RFC v2 00/16] Introduce git-history(1) command for easy history editing

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Sun, Aug 24, 2025 at 1:42 PM Patrick Steinhardt <ps@xxxxxx> wrote:
> Changes in v2:
>   - Add a new "reword" subcommand.
>   - List git-history(1) in "command-list.txt".
>   - Add some missing error handling.
>   - Simplify calling convention of `apply_commits()` to handle root
>     commits internally instead of requiring every caller to do so.
>   - Add tests to verify that git-history(1) refuses to work with changes
>     in the worktree or index.
>   - Mark git-history(1) as experimental.
>   - Introduce commands to manage interrupted history edits.
>   - A bunch of improvements to the manpage.
>   - Link to v1: https://lore.kernel.org/r/20250819-b4-pks-history-builtin-v1-0-9b77c32688fe@xxxxxx

Having test-driven this a bit, I wanted to mention a feature from my
editor that I use frequently and that "reword" reminded me of [*]. I
wonder if this would be a good fit for git-history, but certainly
wouldn't be _necessary_ for a v1.

With fugitive.vim [1], I can get a list of {staged,unstaged} changes
and commits. It looks something like this

Head: ps-jj
Rebase: origin/master
Push: benknoble/ps-jj
Help: g?

Unstaged (1)
M README.md

Unpushed to origin/master (16)
5c65c405e6 builtin/history: implement "reword" subcommand
b215e38d49 builtin/history: implement "split" subcommand
93977ef8d2 wt-status: provide function to expose status for trees
b09b4b9d48 add-patch: add support for in-memory index patching
[…]

If I stage changes, then the following mappings are available when the
cursor is on any commit line:

cF                      Create a `fixup!` commit for the commit under the
                        cursor and immediately rebase it.

cS                      Create a `squash!` commit for the commit under the
                        cursor and immediately rebase it.

What they do is populate my command line with something like

:Git commit --fixup=<commit>|Git -c sequence.editor=true rebase
--interactive --autosquash <commit>^

(The pipe is Vim's command separator, a bit like ";" or "&&" in shell.)

If git-history had a squash or fixup mode, I imagine it would function
similarly (and could be used as the backend for fugitive's cF/cS with
new enough Git).

[*] The reason I thought of this from "reword" is the obvious tie-in
to interactive rebase commands. Fugitive does have "cw" to reword the
last commit, "ca" to amend, and "cW" to "amend!" an arbitrary commit,
but no mappings that "amend!" + rebase immediately. It doesn't need
them because "rw" starts an interactive rebase with the commit under
cursor set to "reword" ;) likewise "rd" for drop.

[1]: https://github.com/tpope/vim-fugitive

-- 
D. Ben Knoble





[Index of Archives]     [Linux Kernel Development]     [Gcc Help]     [IETF Annouce]     [DCCP]     [Netdev]     [Networking]     [Security]     [V4L]     [Bugtraq]     [Yosemite]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Linux SCSI]     [Fedora Users]

  Powered by Linux