Skip to content

Text UI for Jujutsu based on fzf, centering around the jj log with key bindings for common operations

License

Notifications You must be signed in to change notification settings

tim-janik/jj-fzf

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

License Issues Irc

JJ-FZF

JJ-FZF Intro JJ-FZF Introduction: Asciicast MP4

About jj-fzf

JJ-FZF is a text UI for jj based on fzf, implemented as a bash shell script. The main view centers around jj log, providing previews for the jj diff or jj obslog of every revision. Several key bindings are available to quickly perform actions such as squashing, swapping, rebasing, splitting, branching, committing, abandoning revisions and more. A separate view for the operations log jj op log enables fast previews of old commit histories or diffs between operations, making it easy to jj undo any previous operation. The available hotkeys are displayed onscreen for simple discoverability. The commands and key bindings can also be displayed with jj-fzf --help and are documented in the wiki: jj-fzf-help

The jj-fzf script is implemented in bash-5.1, using fzf and jj with git. Command line tools like sed, grep, gawk are assumed to provide GNU tool semantics.

Usage

Start jj-fzf in any jj repository and study the keybindings. Various jj commands are accesible through Alt and Ctrl key bindings. The query prompt can be used to filter the oneline revision display from the jj log output and the preview window shows commit and diff information. When a key binding is pressed to modify the history, the corresponding jj command with its arguments is displayed on stderr.

Features

Splitting Commits

This screencast demonstrates how to handle large changes in the working copy using jj-fzf. It begins by splitting individual files into separate commits (Alt+F), then interactively splits (Alt+I) a longer diff into smaller commits. Diffs can also be edited using the diffedit command (Alt+E) to select specific hunks. Throughout, commit messages are updated with the describe command (Ctrl+D), and all changes can be undone step by step using Alt+Z.

Splitting Commits Splitting Commits: Asciicast MP4

Merging Commits

This screencast demonstrates how to merge commits using the jj-fzf command-line tool. It begins by selecting a revision to base the merge commit on, then starts the merge dialog with Alt+M. For merging exactly 2 commits, jj-fzf suggests a merge commit message and opens the text editor before creating the commit. More commits can also be merged, and in such cases, Ctrl+D can be used to describe the merge commit afterward.

Mergin Commits Mergin Commits: Asciicast MP4

Rebasing Commits

This screencast demonstrates varies ways of rebasing commits (Alt+R) with jj-fzf. It begins by rebasing a single revision (Alt+R) before (Ctrl+B) and then after (Ctrl+A) another commit. After that, it moves on to rebasing an entire branch (Alt+B), including its descendants and ancestry up to the merge base, using jj rebase --branch <b> --destination <c>. Finally, it demonstrates rebasing a subtree (Alt+S), which rebases a commit and all its descendants onto a new commit.

Rebasing Commits Rebasing Commits: Asciicast MP4

"Mega-Merge" Workflow

This screencast demonstrates the Mega-Merge workflow, which allows to combine selected feature branches into a single "Mega-Merge" commit that the working copy is based on. It begins by creating a new commit (Ctrl+N) based on a feature branch and then adds other feature branches as parents to the commit with the parent editor (Alt+P). As part of the workflow, new commits can be squashed (Alt+W) or rebased (Alt+R) into the existing feature branches. To end up with a linear history, the demo then shows how to merge a single branch into master and rebases everything else to complete a work phase.

Mega-Merge Workflow Mega-Merge: Asciicast MP4

License

This application is licensed under MPL-2.0.