Repository navigation
v1.4.0
--exec can now show a result before landing it, and refuses two ways a scripted rewrite used to land wrong while reporting ok.
--dry-run builds the result in the same isolated worktree and stops there. It names the tip the result was built on and the git range-diff that compares the two, and leaves the result addressable by SHA, with nothing verified or applied. The last line before the trailer is the landing, pinned to that tip:
git edit --exec --base=<tip> -- git reset -q --hard <sha>
It refuses if the branch moved in the meantime. Inspect a scripted rewrite this way rather than by running the script outside --exec, where the closing reset --hard that hands its result back moves the shared checkout's branch and discards its working tree. A verify flag on a dry run refuses, since the gate belongs to the run that lands the result.
--base=<sha> names the tip a result was built on. The compare-and-swap covers the command's own run and nothing before it, so a history built earlier – elsewhere, then landed with git reset --hard – said nothing of the tip it started from: whatever reached the branch meanwhile left with the rest, and the run still reported ok. A result carrying a commit made before the run now refuses where it takes commits off the branch, naming the newest of them, unless --base names the tip it was built on. Where the branch has moved past that tip, the run refuses before the command starts, naming what arrived since and the git rebase --onto that carries it onto the result inside the run. A descendant of the tip lands as ever, and so does anything the command builds itself. A rebuild that keeps its commits' original committer dates reads as built before the run, though, and now needs --base at the current tip – a run that used to land and now refuses, which is what the minor version says.
A result whose messages end in more blank lines than the commits they replace refuses too, naming them. It is the mark of a rebuild loop reading a message with %B and handing it to commit-tree unchanged: each pass adds a blank line to every message it rebuilds, and neither git log nor git range-diff shows it. Commits are matched by subject, or by author and author date, which a reword keeps, and one brought in from elsewhere replaces nothing and lands as it was. A loop that carries a message byte for byte, or trims it, passes.
A checkout file left at the new tip's content under another mode – an executable bit lost to a file moved into place – is now named apart, both modes given, with the chmod that matches the commit. It used to be listed as carrying uncommitted edits, which on a file just committed whole invites committing "the rest". A fold and --exec reconcile the checkout the same way.
--selftest=<ids> runs picked scenarios – --selftest=83-87,90, an open end running to the suite's own – together with any a scenario names in a # needs mark, and its trailer says what ran. It is meant for development: the scenarios share one repository, so a pick proves only what it ran, and a commit or a release takes the whole suite.
On a terminal, or where GIT_EDIT_PROGRESS is set, the verify gate now names each commit as its check starts – Checking 2 of 5 – <sha> <subject> – so a long gate can be followed. A captured run stays as it was, as a line per commit would only fill output read after the fact.
A run stopped by SIGHUP, SIGINT or SIGTERM now cleans up as a failed run does and exits 129, 130 or 143. It used to leave its worktree registered behind, out of --abort's reach. A signal that arrives after the branch moved names the move in the trailer – stopped by SIGTERM after refs/heads/main moved <old> → <new> – which git edit --undo takes back, and a --continue stopped after it landed no longer stays paused.
The man page's snapshot-map recipe now covers carrying each commit's message and author date, and the hand-authored fold whose replay stops at every later commit that rewrote its lines: map that fold instead, as edits every snapshot from its target up matches exactly once.
brew install thomasbachem/tap/git-edit
Or brew upgrade git-edit where it is already installed, or pull the repo if its folder is on your PATH.