Skip to content

Add a feature where pressing e on a commit's header or message runs git history reword - #1461

Open
christarazi wants to merge 4 commits into
jonas:masterfrom
christarazi:diff-reword-commit
Open

christarazi wants to merge 4 commits into
jonas:masterfrom
christarazi:diff-reword-commit

Conversation

@christarazi

@christarazi christarazi commented Oct 21, 2026 •

Copy link
Copy Markdown

Add a feature where pressing e on a commit's header or message in the diff
and log views runs git history reword on the commit equivalent to a reword
in an interactive rebase. Previously, if you press e, the UI would report
"Nothing to edit".

git history was added in git 2.54 and is marked experimental. On older
versions, make tig report that rewording requires git 2.54 or newer.

git history also rewrites the commit's descendants, so after a reword
all displayed views are refreshed, and the diff view is reloaded on the
rewritten commit instead of the old one.

The first two commits are preparatory.

Testing, with git 2.55:

  • make test: 593 assertions in 158 tests passed (3 skipped)
  • make test-address-sanitizer: 594 assertions in 159 tests passed (2 skipped)

The new reword tests need git 2.54, so CI will likely skip all but
test/diff/reword-unsupported-test.

The log view skips the graph prefix itself before copying the rev from a
commit line. Do it in the helper instead.

See subsequent commit.

Signed-off-by: Chris Tarazi <tarazichris@gmail.com>
Allow tests to skip on git older than 2.54, which added git history.

See subsequent commit.

Signed-off-by: Chris Tarazi <tarazichris@gmail.com>
Previously, pressing 'e' on a commit's header or message in the diff and
log views reports "Nothing to edit".

This commit makes it so that when the user presses 'e' on the commit's
header or the message in the diff and log views, it runs `git history
reword` on the selected commit instead.

git history needs git 2.54, so check for it and report the requirement
on older versions.

Signed-off-by: Chris Tarazi <tarazichris@gmail.com>
git history rewrites the commit and its descendants, but the diff view
keeps showing the old commit. Find the rewritten commit by its position
from a branch tip and reload the diff view on it. Refresh the other
displayed views too.

Signed-off-by: Chris Tarazi <tarazichris@gmail.com>
@christarazi
christarazi marked this pull request as ready for review October 21, 2026 03:56
@christarazi

Copy link
Copy Markdown
Author

This is really useful in my workflow so I figured I'd see if upstream would consider it. Open to feedback on it 🙂.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant