Skip to content

v1.8.0

Choose a tag to compare

@thomasbachem thomasbachem released this 10 Oct 16:50
· 121 commits to main since this release

git edit --land=<branch> lands a finished branch on the checked-out one in a single call – a fast-forward where it can, else a replay onto the tip in a worktree of its own – beside other sessions' uncommitted work. What lands is the commits the checked-out branch never held, read from its reflog, so a land taken back, a catch-up or a rewrite of the target neither leaves the branch's commits out nor brings back what the target dropped. A commit that looks like a copy of one the target holds – a cherry-pick, or one reworded since it landed – refuses rather than be guessed at, naming the steps that bring its change in or leave it out.

git edit --commit and --amend-into now compose a commit from your own edits alone – a peer's lines in the same file and its staging stay out – and --after/--before land it beside the commit it belongs with, in one run. Every edit, drop and squash now runs in a worktree of its own, a terminal's run too, and once a run lands, the checkout it started in comes along. A run that can no longer land stops at once, and a pause wins over a run already in flight, so sessions sharing a branch no longer lose finished conflict resolutions.

-M --subject=<line> replaces a commit's subject alone, its body kept byte for byte. A run blocked by another session's pause waits up to 90 s for it to clear, then runs on what that pause landed – --wait=<secs> sets the bound. And git edit -h <topic>... prints the manual's entries for flags or sections as plain text, one call where a lookup used to grep --help.

Upgrading from 1.7.0

  • Once a run lands, the checkout it started in comes along – an agent's run too, where 1.7.0 printed steps to run, bar --onto
  • GIT_EDIT_NO_AUTO_ISOLATE is gone, ignored now – every edit, drop and squash runs isolated, -C naming where
  • At a terminal, Ctrl-C at a pause leaves it for later and Escape cancels only when pressed twice, where 1.7.0 aborted on either
  • An option error prints its refusal and a pointer to git edit -h <flag>, no longer the whole usage – a bare git edit still shows it
  • Upgrade every copy that works on a repository together: 1.7.0 reads 1.8.0's undo records as runs, so its --undo would redo a run 1.8.0 took back

What 1.7.0 accepted and this release refuses, each refusal naming why:

  • A flag's value given apart can't be a flag or -- – -M --text --yes no longer rewords to "--yes" – and a word running on past a flag's name is an unknown option
  • --continue, --skip and --abort refuse a commit or mode beside them
  • An --exec result the command builds on a commit below the starting tip – a reset there, then new commits – needs --base, as one built before the run already did
  • A new -C path inside the checkout refuses unless git ignores it there
  • A resolution that takes in what a later commit changes refuses, naming that commit, and a reorder or --move ending on another tree refuses, naming the files, where 1.7.0 printed a note and landed
  • A resume refuses where a commit was taken out of a paused replay by hand, or stepped over with a raw git rebase --skip whose change the replay lacks – an emptied step, which 1.7.0 said to skip by hand, now drops at --continue
  • --carry refuses while a merge, rebase, cherry-pick or revert is in progress in the checkout
  • --allow-new-path no longer lets a removal fold below the commit that adds its path
  • --onto beside --undo, --carry or --status refuses, as does a run outside a repository
  • A run whose branch another session paused on while it ran refuses at its landing

New

Isolated runs

  • The in-place rebase and its stash are gone, and with them their failures: ignored files overwritten, a merge in progress turned into a plain commit, staged changes unstaged by the pop
  • A terminal's edit, drop or squash lands as an agent's did – by compare-and-swap, journaled for --undo, checked by a configured gate
  • An --exec command runs in the worktree's copy of the directory you call from, GIT_PREFIX naming it. One that leaves a rebase, merge or pick stopped partway lands nothing, and one naming a program the tip lacks refuses before it runs

At a terminal

  • Every pause asks: Enter resumes it, staging each conflicted file you cleared of markers, Escape twice cancels, q or Ctrl-C leaves it for later
  • GIT_EDIT_ACTOR set, or output not to a terminal, makes a run an agent's – a pause exits for --continue, its checkout coming along all the same

Your checkout – the README has the rest

  • Once a run lands – any mode, an undo included – the checkout it started in comes along: untouched files take what landed, your edits merge onto it, and a file, directory or symlink of yours standing where something lands is kept and named
  • A merge that conflicts writes nothing, as the edits may be another session's – the git merge-file line that brings the markers in is named for whoever owns them
  • A checkout remembers the tip it last came along to, so a bare git edit --carry – or the next landing – brings every landing it missed, none twice, a branch switch, a git stash or an upgrade from 1.7.0 in between too
  • Where the sync can't run, the run names that git edit --carry, and --status names a checkout left behind with what brings it along

Committing from a shared checkout – the README has the rest

  • git edit --commit --text <msg> -- <paths> commits files as they stand, as git commit -- <paths> does, composed apart from the shared index, and --amend-into=<sha> --whole -- <paths> folds them
  • Where a file also holds another session's uncommitted lines, --edits, --patch, --put, --rm and --chmod compose the commit or fold from your own changes alone, on the tip's content in a private index
  • Each refuses to take back what another caller landed in the last 7 days, naming the landing and the remedy – --base=<sha> where taking it back is the point
  • --after=<sha> or --before=<sha> lands the commit beside that one instead of at the tip, in the same run – --exec takes them too

Sessions sharing a branch

  • A run whose branch moved since it read it stops before it pauses, runs its gate, resumes or lands, naming who moved it, rather than pausing for a resolution that could never land or running a suite for nothing. --status names the abort and redo such a pause needs
  • A pause wins over a run already in flight on its branch: that run refuses, naming whose pause it is and to rerun with --wait=600, so the pause's finished resolution still lands
  • A pause on one branch no longer blocks --exec or --undo on another – an undo refuses at once, naming whose pause it is
  • A labeled caller's pause is its own – another label's --continue or --abort needs --allow-other-actor – and a resume whose pause another run ended meanwhile lands nothing
  • A run killed after moving its branch, journaling nothing, is journaled by the next run, which re-syncs the index entries it stranded
  • The README and man page gain "Many sessions at once": where many sessions fold into one deep history, land each fix at the tip as a fixup! commit, then squash them in one session at a time

Resumes and the suite

  • --continue stages each conflicted file whose markers you removed and names them – a file git gave no markers is named with the git add or git rm that stages it
  • The suite is a selftest/ folder of one file per scenario beside the script, run side by side with --selftest --jobs

Fixed since 1.7.0

  • -d nope..HEAD – a range whose start names no commit – dropped every commit on the branch
  • A commit made on top of the edited one at an edit's stop landed in place of every commit above it
  • A drop could take every commit of a branch, and a drop, edit, squash or --exec ran on a detached HEAD
  • A rebase quit by hand in a pause's worktree landed its partial result, and a conflict marker committed there landed too
  • -C reset a path halfway through a rebase or merge, another run's path, or another repository's work tree
  • --amend-into and --split read a path with pattern characters as a pattern – app/[id].tsx took app/i.tsx along
  • --carry merged only the files holding edits, leaving the rest of the checkout stale – a removed file, an added one, a link – and a bare one took the last rewrite alone
  • A landing offered a git restore for the files it left stale, which, run later, takes an edit another session made since
  • Enter at a terminal pause ran git add --all, conflict markers included
  • A second --undo of the same run took back the run before it, and an undo could take pushed commits off the branch
  • A reword re-read the tip after its editor, so a commit landed and taken back meanwhile could ride along
  • A rebuilt commit now keeps its author line and message byte for byte – a missing last newline, trailing blank lines, a -0000 zone – the editors follow core.commentChar and commit.cleanup, and a message typed for a run then refused is kept in a file the refusal names
  • A resumed fold that changed nothing ended ok, where a first run refuses
  • A hook vetoing an amend or a landing read as "Unknown error" or a move during the rebase
  • A temp worktree ignored the config your checkout reads – an onbranch include's identity or signing key, a relative core.hooksPath such as husky's
  • A file committed with CRLF under eol=lf or text blocked a pause, replay or replant
  • A caller's git config, GIT_DIFF_OPTS or GREP_OPTIONS could change git-edit's checks – and a GIT_DIR or GIT_INDEX_FILE naming another repository is refused now
  • A GIT_EDIT_ACTOR label with characters beyond letters, digits, _ and - was dropped – it is kept now, mapped to _ in the reflog
  • A reader going away – | head – stopped a run before it landed
  • A tag left on a rewritten commit was offered a guess by subject, where a branch got its counterpart
  • --move, --onto, --amend-into, --split, --after and --before refused a :/<text> search
  • Rebase todos were edited in a form only BSD sed reads
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.